Skip to content
Vidar Holen edited this page Oct 4, 2015 · 6 revisions

Aliases can't use positional parameters. Use a function.

Problematic code:

alias archive='mv "$@" /backup'

Correct code:

archive() { mv "$@" /backup; }

Rationale:

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.

Exceptions

None.

ShellCheck

Each individual ShellCheck warning has its own wiki page like SC1000. Use GitHub Wiki's "Pages" feature above to find a specific one, or see Checks.

Clone this wiki locally