Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I call my script with ./script -e arg2
However, $@ only shows me arg2. Surprisingly, if I use ./script -s arg2, $@ shows me both arguments. What's going on?
I don't see an invocation option of -e in the bash manpage, and -s doesn't seem as though it would do as you describe..
So, figuring that this has something to do with the code in the script, it would perhaps help to see the code. What do the -e and -s options do within the code? Anything?
Also, you're only passing one arg in your examples, so how can either example show you both args?
Last edited by GrapefruiTgirl; 10-25-2010 at 05:33 AM.
Grapefruit - sorry, I was a little sleepy when I posted, so maybe my question wasn't as clear as it might have been. -e would be arg1, and arg2 would be, well, arg2. `echo $@` in my script would only display arg2, but not arg1 in some cases.
Kenhelm - thanks! You hit the nail on the head, and printf "%s " works beautifully.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.