Computing.Net > Forums > Unix > SCO set prompt to working directory

SCO set prompt to working directory

Reply to Message Icon

Original Message
Name: Sponge Bob
Date: March 15, 2002 at 14:12:56 Pacific
Subject: SCO set prompt to working directory
Comment:

I am using SCO OpenServer Release 5. I use the following line to set my prompt to my working directory:

PS1="${LOGNAME}@${PWD}>"

The login name displays but the current working directory does not. I checked the values of both PWD and OLDPWD and they are null. Do I need to set PWD and OLDPWD?If so, where do I set these? The shell is set to sh but responds more like a ksh shell. I used this same line on an AIX machine and it works fine. Can someone help me please?


Report Offensive Message For Removal

Response Number 1
Name: James Boothe
Date: March 16, 2002 at 06:32:10 Pacific
Subject: SCO set prompt to working directory
Reply: (edit)

I don't think you can set those. Since these values change, it's something that has to be maintained by the shell. Even though you have an enhanced sh, you might try ksh. On HP-UX, sh is enhanced, behaves like ksh, except for couple of features where I still have to use ksh.

On HP-UX, if PS1 or an alias is specified in double-quotes, interpretation occurs instantly, and the resulting value assigned to PS1 or the alias is static. If specified in single-quotes, the uninterpreted string is assigned to PS1 or the alias, to be interpreted dynamically. Don't know how SCO works, but something to keep in mind.

In the event that you might not have $PWD available to you, I tried to nest a pwd command inside the PS1 command. For an alias command, I can nest a command, to be evaluated either immediately or dynamically, but for PS1, I could get a nested command to execute only immediately.


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: SCO set prompt to working directory

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software