7
1
I would like an alias that gives a directory listing in dictionary order with "." files first. It seems that one few ways to accomplish this devoid of writing my own script (which isn't a real problem) is to set the locale with LC_ALL="C"
. (This is per the sorting man page, and multiple other sites).
However setting the locale to "C" can (and does) cause some software installations to break. So my short term solution is akin to this (This is without the additional ls options, for brevity):
alias ls='(LC_ALL="C"; /bin/ls)'
But this does not allow arguments to be "passed" into the subshell.
This of course does not work:
alias ls='(LC_ALL="C"; /bin/ls $*)'
Is there a way to handle this with a simple alias? (As opposed to writing a shell script/function, which I can do).
Holy Cripes! That's what I get for spending so much time in csh/tcsh. I must have read through the bash and zsh documentation a dozen times looking for that and not found it. Incredible. Thanks! – tgm1024--Monica was mistreated – 2018-06-03T23:17:50.793
As a quick aside to the using
ls
instead of fully qualified/bin/ls
direct executable reference. This is something I usually suggest folks do anyway. In most cases, I simply don't want someone else's rendition of what a utility is supposed to do. It presents an open-ended question of what might go wrong in the future. The reference to/bin/ls
is intended and what I suggest to others. – tgm1024--Monica was mistreated – 2018-06-06T12:40:05.980