Hacker News new | ask | show | jobs
by anderskaseorg 1696 days ago
In a script, there will almost never be any aliases defined, because noninteractive shells don’t load ~/.bashrc.

    $ sh -c "which ls; command -v ls"
    /bin/ls
    /bin/ls
If the script is #!bash rather than #!sh, it’s not even possible to define an alias.

    $ bash -c "alias ls='ls --color=auto'; which ls; command -v ls"
    /bin/ls
    /bin/ls
1 comments

You can still define functions in scripts, and those might wrap commands or accidentally share their names.