I have got this code in file scr.sh
:
#!/bin/sh
string='ps -e | less'
$string
And when I execute this script it doesn't work. Why? What I should do to execute command from string variable in shell script?
|
It's better to store commands in functions rather than in variables. Functions are great at it. Variables, not at all.
You could use
|
|||||||||||||
|