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

What is cpu core in linux?

500


Brief about the command nn?

597


What is linux load average?

575


What does uname do in linux?

529


What is tty in linux command?

506






Why we use pwd command in linux?

540


What is shell scripting commands?

521


What is the export command used for?

513


What is the copy command in linux?

460


Which command is used to uncompress gzip files?

583


What is dos and its commands?

603


What does rmdir do in linux?

524


What is bc command in unix?

507


Brief about finger username?

550


What are the examples of simple command?

510