Dr Small
May 12th, 2008, 03:50 PM
I have been trying to design a simple prompt (nothing very spectacular) that will run input as commands from variables I set in the script.
Example,
OPEN='ged $1'
while true; do
echo -n "prompt> "
read command
"$command"
done
the variable OPEN I wish to act as a command, so when I run it in my prompt, it executes the value of the variable, but so far I have not had any luck at this.
So if I run the script, it ouputs:
prompt>
And then I would type:
prompt> OPEN /path/to/file.txt
And it would execute the OPEN variable, and run my command. Any way to do this?
Dr Small
Example,
OPEN='ged $1'
while true; do
echo -n "prompt> "
read command
"$command"
done
the variable OPEN I wish to act as a command, so when I run it in my prompt, it executes the value of the variable, but so far I have not had any luck at this.
So if I run the script, it ouputs:
prompt>
And then I would type:
prompt> OPEN /path/to/file.txt
And it would execute the OPEN variable, and run my command. Any way to do this?
Dr Small