Academic Work Personal
|
Bash /
Alias with argument(s)
QuestionHow to pass an argument / several arguments to an alias in Bash? Answer #1Use a shell function instead of an alias. Example: Put it in your function hi() { echo hi "$1"; } function hi_all() { echo hi "$@"; } jabba@hoth:~$ hi laci hi laci jabba@hoth:~$ hi_all jabba laci hi jabba laci Answer #2Write a shell script instead of an alias. Example: Put it in a file called #!/usr/bin/bash echo hi "$1" jabba@hoth:~$ ./hi.sh lacus hi lacus |
anime | bash | blogs | bsd | c/c++ | c64 | calc | comics | convert | cube | del.icio.us | digg | east | eBooks | egeszseg | elite | firefox | flash | fun | games | gimp | google | groovy | hardware | hit&run | howto | java | javascript | knife | lang | latex | liferay | linux | lovecraft | magyar | maths | movies | music | p2p | perl | pdf | photoshop | php | pmwiki | prog | python | radio | recept | rts | scala | scene | sci-fi | scripting | security | shell | space | súlyos | telephone | torrente | translate | ubuntu | vim | wallpapers | webutils | wikis | windows Blogs and Dev. * Ubuntu Incident Places Debrecen | France | Hungary | Montreal | Nancy Notes Hobby Projects * Jabba's Codes Quick Links [ edit ] |