1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Effect of using eval to execute a command as opposed to writing it on the commandline

Discussion in 'Shell Script' started by daudiam, Aug 28, 2010.

  1. daudiam

    daudiam New Member

    Joined:
    Aug 28, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    cmd='date | wc'
    $cmdIf this script is executed, an error is generated. The reason written was that "The execution fails because the pipe is not expanded and is passed to date as an argument". What is meant by expansion of pipe. When we execute date | wc on the command line, it goes fine. then | is not treated as an argument. Why?

    Works correctly using eval though! How?
     

Share This Page