Reputation: 16978
So C shell doesn't have functions I hear, and I need to use aliases... Let's say I have:
command1
command2
...
commandN
And in my mind these N commands make up a "function". Is there any way of putting them into 1 alias?
Also, if I need to pass any arguments to my "function" am I screwed?
Obligatory don't-blame-me-blame-my-company for using c shell.
Cheers
Upvotes: 2
Views: 8910
Reputation: 1820
To have an alias do 2 things, simply add a semicolon, and ensure it is quoted.
alias func "echo do the thing ; echo do the other thing"
To use parameters with aliases, use the following notation.
alias funcargs "echo do the first thing \!:1 ; echo do the second thing \!:2"
Note, these are zero-indexed, with \!:0 being the name of the alias. Caution, if you don't supply an argument, you'd get a cryptic error message.
Here's the little thing I needed for this:
alias venv "python -m venv \!:1 ; source \!:1/bin/activate.csh"
Upvotes: 0