shell - How to create alias for argument/parameter (bash)? -


i tried create alias argument putting code .bashrc

alias malog="/applications/mamp/logs/apache_error.log" 

and tied call different commands, like:

tail -f malog vim malog 

but didn't work. know can write alias work like:

alias tmalog="tail -f /applications/mamp/logs/apache_error.log" alias vmalog="vim /applications/mamp/logs/apache_error.log" ... 

but, maybe there way create alias argument/parameter?

this not alias, set variable full pathname:

mhttpd="/applications/mamp/conf/apache/httpd.conf"  tail -f "$mhttpd" vim "$mhttpd" 

alias shortcut command can use:

alias tail_apache='tail -f /applications/mamp/conf/apache/httpd.conf" 

and use as:

tail_apache 

Comments