That example is indeed what I meant. What’s awful about it?
edit: I use a customized ls alias. Most of the time it’s fine, and when I occasionally need the default output, I can type /bin/ls, no new alias to memorize. The history command suggests I do this pretty infrequently, though ymmv.
ls doesn’t have the version sort option so since you’re aliasing a piped command to sort you’d be passing any additional commands to sort
So
ls -r
Would actually be
/bin/ls | /bin/sort -V -r
You could overcome this with xargs but it’s just definitely a bad idea in general to alias a standard command piped into another command. Will cause headaches.
Where as something like
ls="/bin/ls -r"
Just defaults ls to a reverse sort and you can still safely add additional args.
That example is indeed what I meant. What’s awful about it?
edit: I use a customized
lsalias. Most of the time it’s fine, and when I occasionally need the default output, I can type/bin/ls, no new alias to memorize. Thehistorycommand suggests I do this pretty infrequently, though ymmv.lsdoesn’t have the version sort option so since you’re aliasing a piped command to sort you’d be passing any additional commands tosortSo
ls -rWould actually be
/bin/ls | /bin/sort -V -rYou could overcome this with xargs but it’s just definitely a bad idea in general to alias a standard command piped into another command. Will cause headaches.
Where as something like
ls="/bin/ls -r"Just defaults
lsto a reverse sort and you can still safely add additional args.