Help on setting path variable

Hi there,

I need help on setting the path variable. How can I set the path variable with Bourne Shell. My scripts goes like this, but did not work.

#!/bin/sh

PATH=/usr/bin:/usr/ucb:/etc:/export/home/zchen/home
export PATH

Thanks,
Z

You have the correct syntax. What is the problem you are experiencing?

How did you invoke the script ?

Try this

. myscript.sh

or just source it.

source myscript.sh

when i invoke the script by using interactive command, i.e.

set path=($path /export/home/zchen/home)

it works fine, but when i invoke by sh myscript.sh, it does not work.

any idea?

Like vino said, if you want the PATH to affect your current shell, you need to source the script. Look at his post again.