Operating System - HP-UX
1753428 Members
4984 Online
108793 Solutions
New Discussion юеВ

$* alternative to find command line arguments?

 
SOLVED
Go to solution
SM_3
Super Advisor

$* alternative to find command line arguments?

Hello

Is there an alternative to $* to list/find command line arguments?

I heard someone mention the @ sign the other day!

Thanks
5 REPLIES 5
Bharat Katkar
Honored Contributor

Re: $* alternative to find command line arguments?

Hi,

When used as a command argument, "$*" is equivalent to "$1d$2d...", where d is the first character of the IFS parameter,
whereas "$@" is equivalent to "$1" "$2" .... Inside back single quote
(accent grave) marks (``) \ quotes the characters \, `, and $. If the
back single quotes occur within double quotes, \ also quotes the
character ".

The special meaning of keywords or aliases can be removed by quoting any character of the keyword. The recognition of function names or special command names listed below cannot be altered by quoting them.

From man of ksh.

Hope that helps.
Regards,
You need to know a lot to actually know how little you know
Steve Post
Trusted Contributor
Solution

Re: $* alternative to find command line arguments?

Make a file like this:

#!/bin/ksh
# myfile.sh
for X in "$@"
do
echo " arg $X"
done
for X in "$*"
do
echo " arg $X"
done

Then run it:
sh ./myfile.sh a b c d e f g

You see that $@ takes the letters one at a time and $* takes it all.

steve
SM_3
Super Advisor

Re: $* alternative to find command line arguments?

cheers steve!
Steve Post
Trusted Contributor

Re: $* alternative to find command line arguments?

Wow. I never expected to see points again. I (almost) gave up on being helpful. Thanks for turning my attitude around.
Steve
SM_3
Super Advisor

Re: $* alternative to find command line arguments?

give over...

mind you some of us here need to sort ourselves out.

well I'm glad I changed your attitude, we need folk like you...


thanks