1
I have a weird issue with a bash alias. I have the following alias defined in my .bashrc:
alias rec='nano `ls slurm-* | sort -t. -k3n | tail -1`'
However, when I expand the alias rec
in the shell with CTRL
ALT
E
I get:
nano Remember that all constraints must be readded!
If I execute the alias, I get the same thing:
nano Remember that all constraints must be readded!
If I use which rec
I get the correct expansion:
alias rec='nano `ls slurm-* | sort -t. -k3n | tail -1`'
/home/spack/opt/spack/linux-rhel6-x86_64/gcc-4.4.7/nano-2.6.3-k2cwz7lwjd4zutb7r7cfo63apevyztuw/bin/nano
/home/spack/opt/spack/linux-rhel6-x86_64/gcc-4.4.7/coreutils-8.26-icpocuezd6r7ydd73ipkehkg345372eo/bin/sort
/home/spack/opt/spack/linux-rhel6-x86_64/gcc-4.4.7/coreutils-8.26-icpocuezd6r7ydd73ipkehkg345372eo/bin/tail
This Remember that all constraints must be readded!
is the output of a (supposedly) completely unrelated script that I have written. Any idea what's going on here?
Pretty much any time you try to do something complex with an alias and it isn't working out, you should make it a function instead--though here be careful about parsing the output of
ls
as well – Eric Renouf – 2017-08-13T00:14:33.547