difference between $* and $@ ?
Hi all,
I done a simple script and find no difference between $* and $@. Code:
#!/bin/bash Regards, Noob |
Quote:
For the actual differences see man bash Special Parameters section, then decide which suits your own use case. As for those recommending to use one over the other, you should ask them why so, or consider their context. |
Quote:
Thanks for replying. Maybe i understood the context $* wrongly, but it doesn't showing what i intended it to show. Code:
Sun Dec 21 04:33:19 SGT 2014 > cat test6.sh Regards, Noob |
Quote:
Quote:
So if you set IFS inside your shell that is what you will see, but if exported from outside the shell it will be overridden by the default. Try it! |
It going to be confusing to test by changing IFS because it affects both the way the argument string is interpreted and the way the output appears. Here is a script that demonstrates the difference:
Code:
$ cat atest.sh |
http://tldp.org/LDP/abs/html/interna...s.html#ARGLIST
Read this. Tells you all you need to know about the subject, cites specifically the differences between $* and $@ and shows an example in script form where you can copy/paste/run that to test for yourself. |
All times are GMT -5. The time now is 10:40 AM. |