Shell Alias Taking Multiple Arguments
This page answers questions like these:
- How to make an alias that takes arguments?
- How to make an alias that takes parameters?
- How to pass command line arguments to an alias?
- How to pass parameters to an alias?
Related Links:
Shell String Containing Spaces is Not Splitting
Bash String Manipulation
Embed Quotes in a Shell Command or String
Shell Alias Taking Multiple Arguments:
To make an alias that takes multiple arguments you actually need to make a function, not an alias:
FUNCTION()
{
cp "$1" "$2"
}
- Create a shell function called FUNCTION which can take any number of arguments.
- Inside the function body ...
- To access the Nth function argument, use "$N" where N is a number.
- To access all function arguments where they’re individually quoted, use "$@".
- To access all function arguments where they’re not individually quoted, use "$*".
- Such a function should be put it in your .profile or .bashrc file.
Related Links:
Shell String Containing Spaces is Not Splitting
Bash String Manipulation
Embed Quotes in a Shell Command or String
Home > Linux / Unix > Shell Alias Taking Multiple Arguments
Tags: bash alias taking multiple arguments, ksh alias taking multiple arguments, linux, unix, solaris, bsd, aix
Copyright © HelpDoco.com
shell-alias-with-multiple-args.txt
Linux-Unix/shell-alias-taking-multiple-arguments.htm
1