Bash $@, $*, "$*", "$@"
Dear People,
could someone please give a brief description of what the title mentioned expressions do? I googled it but all i find is weired useless quote pages (the internet is getting worse and worse it seems). Especially I would be interested in understanding what the difference between the unquoted and quoted versions of the same expression is, ie. $@ vs "$@". Thanks for any hints or posts. |
The answer is here:
http://www.grymoire.com/Unix/Sh.html#uh-42 |
The difference is word splitting. The most common case where this matters is if you have file names with spaces in them. Here is my unsophisticated explanation.
This is all fine and good until you bring IFS into the mix. I'll leave it to others to go into that except to say that you shouldn't change IFS from its default value unless you have a very specific need to do so and you remember to change it back immediately. So here's a short, simple Bash script to demonstrate what's happening. Code:
#! /bin/bash Code:
foo$ ./parseargs one two Code:
foo$ ./parseargs one\ two Code:
foo$ ./parseargs I invite informative expansions and corrections on all the above. HTH |
@Telengard: Thank you a lot for the comprehensive explanation. This makes it a lot easier for me to understand it.
|
If you feel your question has been adequately answered then please consider using th thread tools to mark this thread solved.
Your blog is nifty. I like that you use it to share the solutions you find. :) |
Quote:
|
All times are GMT -5. The time now is 01:03 AM. |