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
What does umask 077 mean?
How much ram do I have linux?
Which command is used to delete a group?
How do you create a text file in linux?
How do I check my cpu cores?
What is cat command in linux?
What is top command in linux?
What is a makefile in linux?
What commands are used to see all jobs running in the hadoop cluster and kill a job in linux?
What is linux pwd (print working directory) command?
How can I type in cmd?
How do you insert comments in the command line prompt?
How to recover /etc/passwd file and /etc/shadow file?
What is umask 000?
What is the fastest way to enter a series of commands from the command-line?