I have a problem in echo statement ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • xtremebass
    New Member
    • Nov 2008
    • 38

    I have a problem in echo statement ?

    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
    New Member
    • Mar 2008
    • 144

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

    Comment

    • xtremebass
      New Member
      • Nov 2008
      • 38

      #3
      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.

      Comment

      • micmast
        New Member
        • Mar 2008
        • 144

        #4
        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

        Comment

        Working...