From: Aragorn on
On Saturday 03 April 2010 00:06 in comp.os.linux.misc, somebody
identifying as unruh wrote...

> 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.

He may also be running "cd /usr" from inside a script and expecting his
working directory to be "/usr" after the script exits. That won't work
either, because scripts are executed in a forked shell. If this is
what he wants to accomplish, then he must source the script instead of
running it.

In addition "builtin" is not the name of a command, so naturally Bash
will complain about that.

--
*Aragorn*
(registered GNU/Linux user #223157)
From: despen on
Aragorn <aragorn(a)chatfactory.invalid> writes:

> On Saturday 03 April 2010 00:06 in comp.os.linux.misc, somebody
> identifying as unruh wrote...
>
>> 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.
>
> He may also be running "cd /usr" from inside a script and expecting his
> working directory to be "/usr" after the script exits. That won't work
> either, because scripts are executed in a forked shell. If this is
> what he wants to accomplish, then he must source the script instead of
> running it.
>
> In addition "builtin" is not the name of a command, so naturally Bash
> will complain about that.

home> echo $SHELL
/bin/bash
home> type builtin
builtin is a shell builtin
From: Aragorn on
On Saturday 03 April 2010 01:35 in comp.os.linux.misc, somebody
identifying as despen(a)verizon.net wrote...

> Aragorn <aragorn(a)chatfactory.invalid> writes:
>
>> In addition "builtin" is not the name of a command, so naturally Bash
>> will complain about that.
>
> home> echo $SHELL
> /bin/bash
> home> type builtin
> builtin is a shell builtin

Well, a man learns something new every day... ;-)

--
*Aragorn*
(registered GNU/Linux user #223157)
From: unruh on
On 2010-04-02, Aragorn <aragorn(a)chatfactory.invalid> wrote:
> On Saturday 03 April 2010 00:06 in comp.os.linux.misc, somebody
> identifying as unruh wrote...
>
>> 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.
>
> He may also be running "cd /usr" from inside a script and expecting his
> working directory to be "/usr" after the script exits. That won't work
> either, because scripts are executed in a forked shell. If this is
> what he wants to accomplish, then he must source the script instead of
> running it.
>
> In addition "builtin" is not the name of a command, so naturally Bash
> will complain about that.

Actually, it is. It is a builtin command. Which makes me suspect
strongly that he is not running the script under bash. Maybe sh,
although builtin is also a builtin under sh.


>