I’ve got a small script which is returning a string/path. This path is an executable, how can I run the executable? Thank you.
Example:
my_command commands other commands … returns /home/mydesktop/myexecutable
I’d need to execute /home/mydesktop/myexecutable
You could try this:
The backticks get replaced by the output of the command and that is then evaluated. Since it is at the start of the input line,
bashtries to execute it.This is a handy trick to know, since you can use it for all sorts of fun:
will prepend the current date to a copy of your file for poor mans backup…
EDIT: In the comments, we learned, that you should actually be using the
$()syntax. So, that amounts to:and
since you can nest this…