Connecting Tech Pros Worldwide Forums | Help | Site Map

I have a problem in echo statement ?

Member
 
Join Date: Nov 2008
Posts: 35
#1: Feb 13 '09
Hi Bytes..


I have command like this..

echo "km=cat /proc/meminfo | grep MemFree | awk '{ print $2 }' "

i want to redirect this output to a file or output prompt i got printed

km=cat /proc/meminfo | grep MemFree | awk '{ print }'

actually i want to print the full command in file .

like this below ,

echo "km=cat /proc/meminfo | grep MemFree | awk '{ print $2 }' "

what i have to do tel me some suggestion .

micmast's Avatar
Familiar Sight
 
Join Date: Mar 2008
Location: Belgium
Posts: 137
#2: Feb 13 '09

re: I have a problem in echo statement ?


echo "km=cat /proc/meminfo | grep MemFree | awk '{ print \$2 }' "
Member
 
Join Date: Nov 2008
Posts: 35
#3: Feb 13 '09

re: I have a problem in echo statement ?


Thanks for reply.

i need one more thing about displaying the output like below when i redirect the output in a file.

echo "km= `cat /proc/meminfo | grep MemFree | awk '{ print \$2 }'` "

this full command must be store in a file so what i want to add in front of that echo so as to get the output below when i run that file.

echo "km= `cat /proc/meminfo | grep MemFree | awk '{ print \$2 }'` "

in a file

Please do help or give me an suggestion for this problem.
micmast's Avatar
Familiar Sight
 
Join Date: Mar 2008
Location: Belgium
Posts: 137
#4: Feb 13 '09

re: I have a problem in echo statement ?


I think you want to store the command in a file right?
this can be done like this:

echo "km= `cat /proc/meminfo | grep MemFree | awk '{ print \$2 }'` " > run.sh

> to append
>> to write a new file
Reply