Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to display backslashes from a command stored in a variable

I have a file list of Unix comands with backslashes and other special characters. I am reading it into a loop and running the commands. At present I have :


cat Udata

LineNum=1


while read line

do

echo

echo

echo "**********************************"

echo "Process $LineNum"

echo "Code is >> $line"

echo "Results are: "

echo

eval "$line"

(( LineNum++ ))


done < hmregraw


hmregraw is the file with the commands such as


grep '\tA.:' Udata


The \ is not printing and in eval it is trying to run


grep 'tA.:' Udata


which is wrong. The line being read into the while loop from hmregraw has the \ removed. How can I preserve those backslashes? Is there a way I can do this with out modifying the other departments or creating another duplicate file?


Thank You.

Mac OS X (10.6), original os was osx 10.x now ML

Posted on Apr 12, 2013 4:34 PM

Reply
1 reply

How to display backslashes from a command stored in a variable

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.