Bash, [.bashrc] a function for an alias
[In my .bashrc]
Basically I try to make an alias:
alias e='su -c'
But when I write in a terminal:
~$ e ls -goFha /root
I (obviously) get the error:
su: group oFha does not exist
If $str were replaced by the rest of the command, the herebelow code would
work:
alias e='su -c "$str"'
But alias don't work this way. Therefore, I thought to a function.
Replacing $str by the whole argument string, it could be something like:
e () {
"su -c '$str'"
}
How to get the whole argument string in a function?
How would you write my function?
Thanks
No comments:
Post a Comment