I have simple bash script:
Code:
#!/usr/local/bin/bash
NAME=abc
IP=1.2.3.4
IFACE=eth0
echo "
# $NAME
test_$NAME_rootdir="/directory/$NAME" # comment1
test_$NAME_hostname="$NAME.example.com" # comment2
test_$NAME_ip="$IP" # comment3
test_$NAME_interface="$IFACE" # comment4
" > /test
I know, that something, somewhere is not correct with syntax, cos I have this output:
Code:
# abc
test_=/directory/abc # comment1
test_=abc.example.com # comment2
test_=1.2.3.4 # comment3
test_=eth0 # comment4
But I need:
Code:
# abc
test_abc_rootdir="/directory/abc" # comment1
test_abc_hostname="abc.example.com" # comment2
test_abc_ip="1.2.3.4" # comment3
test_abc_interface="eth0" # comment4
Enclosing characters in single quotes ' preserves the literal value of each character within the quote, so no $ possible, so this is I don`t need.
Enclosing characters in double quotes " preserves the literal value of all characters within the quotes, with the exception of `$',
so this is what I need, but anyway still some faults in output with _ and ""