Sponsored Content
Full Discussion: what is $@
Top Forums UNIX for Dummies Questions & Answers what is $@ Post 302235545 by era on Friday 12th of September 2008 06:18:13 AM
Old 09-12-2008
It expands to the command-line parameters passed to the script. However, it's wrong; it should be in double quotes, like "$@"

Code:
vnix$ cat >script
echo args: "$@"
for f in "$@"; do echo "arg: $f"; done
^D
vnix$ sh ./script foo bar baz
args: foo bar baz
arg: foo
arg: bar
arg: baz


Last edited by era; 09-12-2008 at 07:20 AM.. Reason: Add sample script
This User Gave Thanks to era For This Post:
 
All times are GMT -4. The time now is 01:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy