$2  –  2nd Positional Parameter

$2 is the value of the second positional parameter.

Examples

Print 2nd parameter value
1
echo $2
Print with a fallback value
1
echo ${2-Fallback value}
BashSupport Pro is a Bash and POSIX IDE with support for $2try it now!
© 2020–2024 Joachim Ansorg
Imprint
Privacy Policy
Legal