I came across a weird behavior in the c-shell: when writing the following line, i get exactly the behavior I expect:
ls -l | grep $USER | somescript `awk -F' ' '{print $1}'`
meaning - it will search all items owned by me and activate 'somescript' with their first field as argument.
however, when I try aliasing the same line, it jams my shell (or hands out error massages if i separate the braces from the apostrophe:
alias doit 'ls -l | grep $USER | somescript `awk -F' ' '{print $1}'`'
will result in either
{: Command not found
print: Command not found
or simply not being able to start a new terminal as it gets jammed.
any idea how can alias this thing (and similar things - this is just an example) without killing my shell?
Welcome to the hell that is
csh
. I'm not sure this answer will prevent you from killing yourself, but...Result:
It's basically a concatenation of strings, each in alternating quotes:
(Yes, this could be simplified, but I wanted to show a consistent, general procedure for aliasing commands containing single-quotes.)