From: frank_0 on 2 Apr 2010 16:17 Ubuntu 9.10. From the prompt, the command cd /usr works. It does not work in a bash script. When I try as an alternative builtin cd /usr bash tells me "builtin not found". Where is the error or where is the problem? Just in case, bash has been re-installed to no avail. Thanks. frank
From: despen on 2 Apr 2010 16:33 frank_0 <y199mp1505(a)gmail.com> writes: > Ubuntu 9.10. From the prompt, the command > > cd /usr > > works. It does not work in a bash script. You really should be specific. "It does not work" is vague. > When I try as an alternative > > builtin cd /usr > > bash tells me "builtin not found". > > Where is the error or where is the problem? > Just in case, bash has been re-installed to > no avail. Sounds like youv'e written a script but the first line is not: #!/bin/bash so you are getting some other shell. Post specifics, what you did, what you got, use copy/paste.
From: Jerry Peters on 2 Apr 2010 16:58 frank_0 <y199mp1505(a)gmail.com> wrote: > Ubuntu 9.10. From the prompt, the command > > cd /usr > > works. It does not work in a bash script. > When I try as an alternative > > builtin cd /usr > > bash tells me "builtin not found". > > Where is the error or where is the problem? > Just in case, bash has been re-installed to > no avail. > > > Thanks. > > > frank What does "it doesn't work mean"? I'm just guessing here, but if you're expecting the script to change the working directory and for the change to persist after the script completes, it doesn't work that way, which is why cd is a builtin. Jerry
From: Florian Diesch on 2 Apr 2010 17:18 frank_0 <y199mp1505(a)gmail.com> writes: > Ubuntu 9.10. From the prompt, the command > > cd /usr > > works. It does not work in a bash script. What exactly means "does not work" here? Just in case: The current working directory is a property of the currently running program. As a shell script starts a new shell instance a cd inside a script doesn't influence the shell calling that script. Florian -- <http://www.florian-diesch.de/software/shell-scripts/>
From: unruh on 2 Apr 2010 18:06 On 2010-04-02, frank_0 <y199mp1505(a)gmail.com> wrote: > Ubuntu 9.10. From the prompt, the command > > cd /usr > > works. It does not work in a bash script. > When I try as an alternative > > builtin cd /usr > > bash tells me "builtin not found". > > Where is the error or where is the problem? > Just in case, bash has been re-installed to > no avail. > How do we know. You give no information. What is the full details of your script and how are you calling it? Note for most people the above commands do work from scripts. Eg, you may not be running the script under bash. > > Thanks. > > > frank
|
Next
|
Last
Pages: 1 2 Prev: Can I read an smb share without mounting it Next: linux network question |