I am writing a bash script that runs each of its arguments as a command. This works for commands in my PATH, but not for aliases. I can directly call an alias in the script, but I can't call an alias that has been passed as an argument.
The problem (I assume) is that aliases are expanded before variables.
I've been scratching my head over this one for a while now. It seems so simple yet I just can't get it to work. This is on a rooted android tablet, if that makes a difference. I'm trying to imitate the behavior of sudo on a normal linux system. I'm not very experienced when it comes to bash scripting, so this is probably very simple.
I'm still kind of new to the *nix world, so please excuse the "noobishness" of the question.
What I essentially want to know is the difference between aliases and functions in the bash shell - and when to use which one.
It seems obvious that since functions can take arguments, they are a lot more powerful - since I work mainly on the road with a netbook and want to save energy and processing powe
eval takes its arguments, concatenates them, and executes the resulting string as Bash code in the current execution environment. eval in Bash works in essentially the same way as most other languages that have an eval function.