By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,289 Members | 3,049 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,289 IT Pros & Developers. It's quick & easy.

I have a problem in echo statement ?

P: 38
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 .
Feb 13 '09 #1
Share this Question
Share on Google+
3 Replies


micmast
100+
P: 144
echo "km=cat /proc/meminfo | grep MemFree | awk '{ print \$2 }' "
Feb 13 '09 #2

P: 38
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.
Feb 13 '09 #3

micmast
100+
P: 144
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
Feb 13 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.