I'm trying to create a bash alias, where the alias itself has a space in it.
The idea is that the alias (i.e. con
) stands for sudo openvpn --config /path/to/my/openvpn/configs/
. Which results in a readable command, when the con
alias is used.
i.e: `con uk.conf` == `sudo openvpn --config /path/to/my/openvpn/configs/uk.conf`
I understand that I can't declare the alias like this:
con ="sudo openvpn --config /path/to/my/openvpn/configs/"
.
Would bash functions work in this scenario? I've never heard of that, but when researching a solution for this minor issue.
"$@"
instead of"$1"
so that subsequent arguments are passed through, too. (General comment, possibly irrelevant to the specific case here) – Toby Speight Dec 03 '15 at 15:27com uk.conf -something else
would translate tosudo openvpn --config /path/to/my/openvpn/configs/uk.conf -something else
? – TMH Dec 03 '15 at 15:51$@
contains all parameters given. See What is the difference between $* and $@?. – terdon Dec 03 '15 at 15:56