Home > Mobile >  How to create string for using variables inside string in shell-script
How to create string for using variables inside string in shell-script

Time:08-13

Hi My variable is not getting String using shell-script

I try to create string variable But getting Error :- "Missing }."

log_handler_ws_async="<property name='path' value='"${domain.home}"/servers/"${weblogic.Name}"/logs/async.log'/>"

When we use this variable. it's will get same string... we don't want value for this ${weblogic.Name}

echo $log_handler_ws_async

expected output:-

"<property name='path' value='"${domain.home}"/servers/"${weblogic.Name}"/logs/async.log'/>"

CodePudding user response:

You may use read builtin with heredoc:

read -r log_handler_ws_async <<-'EOF'
<property name='path' value='"${domain.home}"/servers/"${weblogic.Name}"/logs/async.log'/>
EOF

echo "$log_handler_ws_async"

<property name='path' value='"${domain.home}"/servers/"${weblogic.Name}"/logs/async.log'/>
  • Related