Tuesday, 27 October 2020

Shell Scripting use of variable in string

 With braces: echo "${ANIMAL}s are the best."

With quotes: echo "$ANIMAL"'s are the best.'

With printf: printf '%ss are the best.\n' "$ANIMAL"



The best way is to use ${variable} in string because when you need multiple variable in a string, its easier


https://stackoverflow.com/questions/18320133/how-do-we-separate-variables-from-letters-in-shell-scripting

No comments:

Post a Comment