Pattern: Use of alias
with positional parameter
Issue: -
Aliases just substitute the start of a command with something else. They therefore can't use positional parameters, such as $1
. Rewrite your alias as a function.
Example of incorrect code:
alias archive='mv "$@" /backup'
Example of correct code:
archive() { mv "$@" /backup; }
If your alias ends up quoting the value, e.g. alias cut_first="awk '{print \$1}'"
, you can technically ignore this error. However, you should consider turning this alias into a more readable function instead: cut_first() { awk '{print $1}' "$@"; }