Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's 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.
That ought to work. I tried in on Slackware. Picked it apart step by step. It all looks good.
I am using bash. Verify that is the shell you are using. If it is, I see no difference. In fact, I was able to properly set the environment variable, $REVS, with the revision on my own svn repo.
To do that invoke the parent shell:
Code:
. ./test.sh
Then:
Code:
echo $REVS
Maybe Ubuntu is doing something different? Are they using dash instead of bash now?
Code:
echo $SHELL
It should output /bin/bash for bash and /bin/dash for dash. Maybe dash handles it differently? I'm grasping at straws here but perhaps even when you are forcing the #!/bin/bash maybe it is still picking up dash because that is installed and bash is not? I don't know, maybe dash would work anyway. This really looks okay, anyone with Ubuntu that can verify?
Last edited by meetscott; 02-19-2010 at 12:40 AM.
Reason: left out "and" in my sentence.
If you just copy-n-paste that (dual) 'line' into an editor, it will silently insert a hard newline between the lines. Use shift-j (in vim) to re-join into one line.
If you just copy-n-paste that (dual) 'line' into an editor, it will silently insert a hard newline between the lines.
So? How does joining the lines change his intent? Or more importantly the shell interpretation? The #!/bin/bash should be on a line on its own. What am I not understanding here?
Did I just miss the joke? Okay, ha ha.
Quote:
Use shift-j (in vim) to re-join into one line.
It must be, because you are giving simple, irrelevant editor command lessons :-)
The error happens only when I run with this command
sh test.sh
But it runs OK when I run with this command
./test.sh
I do not know why they are different
Thanks
john
I am not sure but "export" is not a tool.
It is a builtin of Bash.
So this should work:
bash test.sh
I would expec "sh" does not know this.
Just test the bash test.sh command
And see if it works.
If it does, then this is normal behaviour and the above explains your error
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.