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
How do I check if my cpu is overclocked?
What does top do in linux?
What is $$ in shell script?
What is dos and its commands?
Explain trap command of linux?
How do I run a command in linux?
What is the use of ls command?
How do I find old commands in linux?
How do I stop a linux job?
How do I run a script in linux?
What are runlevels in linux?
Brief about FTP hostname?
How cp command works in linux?
You wish to print a file ‘draft’ with 60 lines to a page. What command would you use?
State and explain about features of UNIX?