0

hi I have following propertie file (something.properties)

SERVER1_PROPERTY1=123    
SERVER1_PROPERTY2=${SERVER1_PROPERTY1}/123

and following bash script fetching one of the properties:

#!/bin/bash

. something.properties

SRV="SERVER1"

eval PROPERTY2=\$${SRV}_PROPERTY2

echo $PROPERTY2

the result is:

123/123

but I want it to be

${SERVER1_PROPERTY1}/123

How can I achieve this?

1 Answer 1

1

The expansion is done when you source the file (. something.properties).

Write SERVER1_PROPERTY2='${SERVER1_PROPERTY1}/123' in your properties files to disable expansion.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.