Open main menu

CDOT Wiki β

Changes

Tutorial10: Shell Scripting - Part 1

4 bytes removed, 11:23, 14 March 2021
Variables / Parameters
'''Positional Parameters and Special Parameters'''
[[Image:positional.png|thumb|right|220px|Examples of using '''positional''' and '''special''' parameters.]]A '''positional parameter''' is a variable within a shell program; its value is set from an argument specified on arguments contained in a shell script or using the set command line that invokes the program.
Positional parameters are numbered and their values are accessed by using<br>a preceding "'''$'''" (eg. '''$1''', '''$2''', '''$3''', etc.). The positional parameter '''$0''' refers to<br>either the '''name of shell''' where command was issued, or '''filename of shell script''' being executed.<br>If using '''positional parameters''' greater than '''9''', then you need to include number within braces.<br><br>Examples: '''echo ${10}''', '''ls ${23}'''<br><br>
13,420
edits