Programming and posix - April 2002
April 3, 2002
Solution Symposium
Page 74
hp e3000
programming
and posix
posix shell variables and arrays
• variable=value to assign a scalar variable
• variable=value command to make a variable
assignment visible only to the new command env
• variable[index]=value to assign an array item
• $variable or ${variable} to dereference a variable
• $variable[index] to deference an array item
• ${variable:-default} for the non-null value of
variable else default
• plus about 15 additional variations…
• $? - last exit status value
• $$ - POSIX PID of the current shell
• $! - POSIX PID of the last asynchronous command