Hi,All guys:
I wrote a shell script like this:
#! /usr/bin/sh
cd usr/src/commands/simple
and i run it in minix 2.3.0
but i can not get the right result
#pwd
/
why????
can anybody help me to explain why?
Printable View
Hi,All guys:
I wrote a shell script like this:
#! /usr/bin/sh
cd usr/src/commands/simple
and i run it in minix 2.3.0
but i can not get the right result
#pwd
/
why????
can anybody help me to explain why?
[email]exploit_it@hotmail.com[/email] wrote:[color=blue]
> Hi,All guys:
>
> I wrote a shell script like this:
>
> #! /usr/bin/sh
> cd usr/src/commands/simple
>
> and i run it in minix 2.3.0
> but i can not get the right result
> #pwd
> /
> why????
> can anybody help me to explain why?
>[/color]
Running the script starts a new shell. The script changes the current
directory in the new shell, but when the script terminates also the
shell is terminated. The current directory is the initial.
Try to put the pwd command in the script.
To make the change effectively you must run the script in the current
shell using . i.e.:
# . filename
See also man pages for ash and sh
Ciao
Giovanni
--
A computer is like an air conditioner,
it stops working when you open Windows.
Registered Linux user #337974 <http://counter.li.org/>
Thx,Giovanni
I see now
Exploit_it