Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is the command To print script arguments

Answer Posted / shabab

$* and $@ are the right answers

$# - prints out the number of arguments passed

Consider the below code
########################
for i in "$*"
do
print $i
done

for i in "$@"
do
print $i
done
########################

and you call the script by saying

#samp.sh hai welcome to "Unix Forum"
hai welcome to Unix Forum
hai
welcome
to
Unix Forum


The first line is the output by printing out $*
the next four lines are with the help of $@.

So
$* will combine all arguments to a single string
$@ will have each arguments as a seperate string

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I check if my cpu is overclocked?

1042


What does top do in linux?

1002


What is $$ in shell script?

950


What is dos and its commands?

1082


Explain trap command of linux?

1038


How do I run a command in linux?

1059


What is the use of ls command?

1038


How do I find old commands in linux?

1073


How do I stop a linux job?

991


How do I run a script in linux?

1091


What are runlevels in linux?

1101


Brief about FTP hostname?

1087


How cp command works in linux?

1096


You wish to print a file ‘draft’ with 60 lines to a page. What command would you use?

962


State and explain about features of UNIX?

1047