linux - If bash aliases cannot accept arguments, why do these aliases work? -


as naive noob, created several bash aliases intended accept arguments, , work intended. tried make few more such aliases, however, , these not work intended.

this problem led me here, learned bash aliases not accept arguments. instead, must create function. example see here or here.

so, assuming "bash aliases not accept arguments" consensus correct, why of these work?

alias pacss='pacman -ss ' alias pacs='sudo pacman -s ' alias yausnc='yaourt -s --noconfirm ' 

when these "work" mean that, e.g., typing 'pacs package' results in prompting me password, prompting confirmation, retrieving , installing package.

so, why these aliases work? terms accept not technically considered 'arguments'? idiosyncrasy of arch (or manjaro, using)? hole in space-time continuum?

any clarification shall appreciated.

edit: answers explaining these not calling arguments. don't quite understand how first examples different following attempted alias, not work:

alias lping='ping 192.168.1.' 

this fails because ping executes without appending number type. intent able enter e.g. lping 123 , have bash execute "ping 192.168.1.123" instead says "unknown host 192.168.1."

no, terms "accept" aren't called "arguments".
bash aliases text replacements.
is, when write

pacs 

bash replaces

sudo pacman -s  

and when write

pacs package 

bash replaces

sudo pacman -s package 

in other words, arguments aren't passed alias – characters after alias appended whatever alias expands to.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -