executing variable containing cat command will generate error
If I save my cat command into a string and then I execute it then I will
get an error
linux# cmd="cat /data/test/test.tx* | grep toto"
linux# eval '$cmd'
cat: |: No such file or directory
cat: grep: No such file or directory
cat: toto: No such file or directory
even with
linux# $cmd
cat: |: No such file or directory
cat: grep: No such file or directory
cat: toto: No such file or directory
how to execute this cat command when it's saved into a variable?
No comments:
Post a Comment