On May 5, 2015 1:08:10 AM CDT, Trevor Cordes <trevor@tecnopolis.ca> wrote:
The plot thickens...
I double-checked the exact command I was running when I did the grep...
I ran:
n19 grep -r foobar /
n19 is an alias I've been using forever (and as per last month's RTFM):
/bin/nice -19 /usr/bin/ionice -c2 -n7 -t
I n19 almost everything long-lasting / non-interactive I run.
It just dawned on me: "nah, the shell (tcsh) couldn't be expanding the
n19 alias and *not* expanding the grep alias, could it?"
Sure enough, after a few tests, it is clear the shell only expands the
first alias on the line. So that means (tada) my grep -r wasn't being
run with the --devices option! That is why it was opening the device
files. In my quest to be "nice", I shot myself in the foot.
So now the question is why doesn't the shell expand both aliases (I
guess it's a safety / can't-tell-what-you-mean issue); is there a way
to make the n19
alias expand the command listed after it too; or can I
tell the shell to expand aliases after "modifier" commands (nice, xargs,
etc).
Nice test case (may have to be modified for bash):
#alias n19 '/bin/nice -19 /usr/bin/ionice -c2 -n7 -t'
#nice n19 echo bobo
/bin/nice: n19: No such file or directory
#n19 n19 echo bobo
ionice: failed to execute n19: No such file or directory
In a perfect world the system would "do what I mean" and both above
commands would succeed, just as this does:
nice nice echo bobo
Roundtable mailing list
Roundtable@muug.mb.ca
http://www.muug.mb.ca/mailman/listinfo/roundtable