What’s the difference between $@ and $* in UNIX? When echoed in a script, they both seem to produce the same output.
What’s the difference between $@ and $* in UNIX? When echoed in a script,
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
One difference is in how they handle the IFS variable on output.
If you run this like this:
./demo abc def ghi, you get this output:Notice that (only) the “quoted asterisk” line shows an X between each “word” after
IFSis changed to “X”. If the value ofIFScontains multiple characters, only the first character is used for this purpose.This feature can also be used for other arrays: