1834125 Members
2090 Online
110064 Solutions
New Discussion

Re: view path on prompt

 
SOLVED
Go to solution
Mohd Syafid Abdullah
Regular Advisor

view path on prompt

Hi Guru..
Im using UX 11.
How to set the prompt to become a path directory what i was in.
eg.> if in go to /temp, the prompt become /temp.

Please help
13 REPLIES 13
Robert-Jan Goossens_1
Honored Contributor

Re: view path on prompt

Hi,

Add this to your /root/.profile

PS1="$(hostname):\$PWD\# "
export PS1

Regards,
Robert-Jan
Amit Agarwal_1
Trusted Contributor

Re: view path on prompt

This is the bare minimum command that you need to run.

export PS1="\$PWD $"

You can add the above command in your .profile file, so that it gets executed everytime you login. In addition you can add more things to your prompt, like username and hostname.
Adisuria Wangsadinata_1
Honored Contributor

Re: view path on prompt

Hi there,

Try to add this into your .profile :

USER=`whoami`
export USER
HOSTNAME=`hostname`
export HOSTNAME
PS1='[$USER@$HOSTNAME] $PWD > '
export PS1

Hope this can help you.

Cheers,
AW
now working, next not working ... that's unix
Sergejs Svitnevs
Honored Contributor

Re: view path on prompt

You only need to execute next command on your machine:

HOST=`uname -n`;PS1="\$HOST:\$LOGNAME:\$PWD $ ";export PS1

Regards,
Sergejs
Mohd Syafid Abdullah
Regular Advisor

Re: view path on prompt

guru,
i try to change the script that all of you provide but i failed.
how to make it like this..


#


tq
Sergejs Svitnevs
Honored Contributor

Re: view path on prompt

try execute this command:

HOST=`uname -n`;PS1="\$HOST:\$LOGNAME:\$PWD \n# ";export PS1

Regards,
Sergejs
Adisuria Wangsadinata_1
Honored Contributor

Re: view path on prompt

Hi

Once you update the /.profile, you need to logout & login to see the result.

Cheers,
AW
now working, next not working ... that's unix
Mohd Syafid Abdullah
Regular Advisor

Re: view path on prompt

hi sergejs,

can i make the prompt and dir path in different line..


#

tq
Sergejs Svitnevs
Honored Contributor

Re: view path on prompt

You only need to execute:

export PS1="<\$PWD> \n#"

Regards,
Sergejs
Mohd Syafid Abdullah
Regular Advisor

Re: view path on prompt

it still dont bring it to separate line.
i need to make it in separate line..

Please help
Ermin Borovac
Honored Contributor
Solution

Re: view path on prompt

Try this

PS1='$PWD#'
Mohd Syafid Abdullah
Regular Advisor

Re: view path on prompt

tq ermin..
Mohd Syafid Abdullah
Regular Advisor

Re: view path on prompt

tq all guru