Executing a command named in a variable
Loïc Grenié
loic.grenie at gmail.com
Tue Dec 1 11:10:17 UTC 2009
2009/12/1 Nils Kassube <kassube at gmx.net>:
> Ray Parrish wrote:
>> Would the following work?
>>
>> # set variable to command line
>> ExecuteEditor="/usr/bin/gedit filename.ext"
>> # execute external command.
>> $ExecuteEditor &
>
> No, it wouldn't work because bash will look in /usr/bin for a command
> "gedit filename.ext" which doesn't exist. You would need the eval
> command here but you might as well write it this way:
Did you try before answering ? It works.
Loïc
More information about the ubuntu-users
mailing list