1833189 Members
2860 Online
110051 Solutions
New Discussion

variable path

 
kamal_15
Regular Advisor

variable path

hi all

i have hp-ux v 10.20
i want to make a variable path for a specified directory.
i try the following :

x=/home/kamal/test
when type cd $x
my pwd is /home/kamal/test

but it is temporary.
at next connection
when i type cd $x
the following error appear

sh: x:Parameter not set.
how to define this path variable for permanent usage?
please help
thanx for all.
8 REPLIES 8
Victor BERRIDGE
Honored Contributor

Re: variable path

Hi,
You should export your variable:

export X=/home/kamal/test

Now it should work
All the best
Victor
Patrick Wallek
Honored Contributor

Re: variable path

It needs to be set in the .profile file in your home directory.

Add the following line to your .profile file:

export x=/home/kamal/test


Then next time you log in it should be available.
kamal_15
Regular Advisor

Re: variable path

thankx for all
i tryed it and now its working
but if i want to make this variable
global for all users
it mean i will type

export x=/home/kamal/test
in all users directories .profile??
is there any way ?
thank you
Patrick Wallek
Honored Contributor

Re: variable path

Does everyone need the exact same directory?

If so and if everyone is using ksh or sh for their shell then you can add that line in /etc/profile and it will be available to everyone.
Michael Schulte zur Sur
Honored Contributor

Re: variable path

Hi,

for sh the syntax is
set x=/home/kamal/test;export x

greetings,

Michael
Patrick Wallek
Honored Contributor

Re: variable path

No, you don't have to do the set and exports separately.

Just doing

export x=whatever

will work just fine.
Michael Schulte zur Sur
Honored Contributor

Re: variable path

Patrick,

you are right. I didn't expect sh on HP-UX to behave differently than on Tru64

Michael
kamal_15
Regular Advisor

Re: variable path

thankx for all

it working now
thankx again
kamal