• wheezy@lemmy.ml
    link
    fedilink
    English
    arrow-up
    2
    ·
    6 hours ago

    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.

    • everett@lemmy.ml
      link
      fedilink
      arrow-up
      1
      ·
      4 hours ago

      Thank for explaining, I hadn’t really thought about trying to add additional flags at runtime.

      By the way, my ls actually has it:

             -v     natural sort of (version) numbers within text