Find the answer to your Linux question:
Results 1 to 3 of 3
Hi, I have a bash script that constructs a few varieties of action commands that get executed at the same point. The action will be different depending on how these ...
  1. #1
    Just Joined!
    Join Date
    Apr 2011
    Posts
    2

    Query regarding eval

    Hi,
    I have a bash script that constructs a few varieties of action commands that get executed at the same point. The action will be different depending on how these commands got defined.

    Unfortunately, I'm getting an error with one of them. Perhaps someone could help me out with this:

    The offending line is this:

    eval $ACTION

    The ACTION variable is defined like this:

    ALARM = '/usr/local/bin/finalize.sh INFO admin $MSG'

    The error I get is "INFO not found". Could someone explain how I should be constructing this so that it evaluates in the way I'm looking for?


    Regards,
    Dave

  2. #2
    Linux Newbie
    Join Date
    Mar 2009
    Posts
    228
    I assume you mean:

    ACTION='/usr/local/bin/finalize.sh INFO admin $MSG'

    not ALARM.

    eval $ACTION should work. I think your problem is in the finalize.sh script. Change the shebang line in that script to:

    #!/bin/bash -vx

    so you'll see the commands as they execute.

  3. #3
    Just Joined!
    Join Date
    Apr 2011
    Posts
    2
    Quote Originally Posted by lomcevak View Post
    I assume you mean:

    ACTION=
    eval $ACTION should work. I think your problem is in the finalize.sh script.
    Thanks for your reply. Sorry for not replying sooner.

    The same command line works in a simpler version of the script where I just run it with $MSG simply typed in as a quoted string. So I don't think that finalize.sh is the problem. Or am I misunderstanding your point?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...