About shell script - Minix

This is a discussion on About shell script - Minix ; 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?...

+ Reply to Thread
Results 1 to 3 of 3

Thread: About shell script

  1. About shell script

    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?


  2. Re: About shell script

    exploit_it@hotmail.com wrote:
    > 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?
    >


    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

  3. Re: About shell script

    Thx,Giovanni
    I see now

    Exploit_it


+ Reply to Thread