I have a program that returns a shell script and I want to execute the script.
I'll use cat in my simple example, but wget is an example that is feasible.
$ # First setup a script
$ echo "ls
> df" > simple
$ # "cat simple" is now a program that returns a script
$ cat simple
ls
df
$
Now I want to execute the script returned from "cat simple". I am sure that there must be a way to do it, probably using nothing more than punctuation, but I haven't found it.
$ # This method works, but is ugly and needs write access to somewhere
$ cat simple > /tmp/somefile
$ . /tmp/somefile
< output of ls and df >
$ rm /tmp/somefile
$
$ # I want to do something like this:
$ `cat simple`
ls: cannot access df: No such file or directory
$ # Only it doesn't work
Does anyone have an idea of how to do this without writing to a temporary file?