Results 1 to 4 of 4
Hi,
I am trying to execute a string as command.
Code:
txt="echo \"abc\""
`$txt`
result
Code:
./test.sh: line 2: "abc": command not found
What am I doing wrong?
Thanks.
Michael...
- 06-26-2006 #1Just Joined!
- Join Date
- Jun 2006
- Posts
- 4
[Bash] execute string as command
Hi,
I am trying to execute a string as command.
resultCode:txt="echo \"abc\"" `$txt`
What am I doing wrong?Code:./test.sh: line 2: "abc": command not found
Thanks.
Michael
- 06-26-2006 #2
You might want to try the eval shell command instead of the backticks; maybe that'll work.
Flies of a particular kind, i.e. time-flies, are fond of an arrow.
Registered Linux User #408794
- 06-26-2006 #3Just Joined!
- Join Date
- Jun 2006
- Posts
- 4
Thanks, works like a charm.
Originally Posted by Javasnob
- 10-27-2009 #4Just Joined!
- Join Date
- Oct 2009
- Posts
- 1
used it without the backtick and it worked!
regards,
borncrusader



