w3a - CSC209: Shell Scripting Kante Easley University of...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CSC209: Shell Scripting Kante Easley University of Toronto May 27, 2009 Kante Easley CSC209 CSC209: Positional Parameters Recall that $* and $@ expand to a list of the positional parameters in a shell script. Without quoting these are the same and list all positional parameters There is a problem with ./testpos a b "c d" e f The quoted strings are split up. You can use "$*" and "$@" to get different behavior: "$*" makes the entire list into a single string: "$1, $2, ..." "$@" puts each argument in double quotes: "$1", "$2", ... warning: If there are no parameters at all, "$@" expands to no parameters at all (NOT an empty string). So cat "$@" would process stdin. . . Kante Easley CSC209 CSC209: Positional Parameters The commands set and shift change the meaning of the positional parameters set assigns positional parameters to its arguments. $ set date $ echo "The date today is $2 $3, $6" The date today is May 25, 2006 shift moves $2 into $1 , $3 into $2 , . . ....
View Full Document

Page1 / 12

w3a - CSC209: Shell Scripting Kante Easley University of...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online