Writing " to a file in bash.
Posted
by S1syphus
on Stack Overflow
See other posts from Stack Overflow
or by S1syphus
Published on 2010-04-20T10:54:49Z
Indexed on
2010/04/20
11:03 UTC
Read the original article
Hit count: 235
bash
Simply I need to write
"echo" t${count} = "$"t${count}"
To a text file, including all the So the output would be something like:
echo " t1 = $t1"
With " as they are. So I have tried:
count=1
saveIFS="$IFS"
IFS=$'\n'
array=($(<TEST.txt))
IFS="$saveIFS"
for i in "${array[@]}"
do
echo "echo" t${count} = "$"t${count}""
(( count++ ))
done >> long1.txt
And variations on this such as:
echo "echo" """"" t${count} = "$"t${count}""
But I guess the wrapping in double " is only for variables.
Ideas?
© Stack Overflow or respective owner