PWD env variable for root

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers PWD env variable for root
# 1  
Old 10-18-2001
Question PWD env variable for root

How do you get the $PWD env variable set for root? I know it's automatic for korn and other shells, but root uses /usr/bin/sh.
# 2  
Old 10-18-2001
I assume that you want the current directory as the prompt. I do not beleive that the bourne shell supports this functionality. You can change root's shell, but make sure that it is either in the same directory as the current shell, or that it is on the root slice of the disk.
# 3  
Old 10-19-2001
have you tried


echo $PWD


Aris ;=)
# 4  
Old 10-19-2001
If you shell doesn't set the PWD variable for you automatically, you could always try:
alias cd="cd $@ ; PWD=`pwd`"

You can add that to your .profile, although it may slow you down some...
# 5  
Old 10-19-2001
Thank to all of you..
This was something I was wondering about for quite a while.
# 6  
Old 01-12-2002
I believe that the man page for "cd" says it all.

The variable $HOME controls where you go when you type "cd" <enter>. NOT the $PWD variable.

If you change the variable HOME to HOME=/root for instance, your new "home" directory for root will be "/root" not "/".

cd - change working directory

cd [directory]

If directory is not specified, the value of shell parameter HOME is
used as the new working directory. If directory specifies a complete
path starting with /, ., .., directory becomes the new working
directory. If neither case applies, cd tries to find the designated
directory relative to one of the paths specified by the CDPATH shell
variable. CDPATH has the same syntax as, and similar semantics to,
the PATH shell variable. cd must have execute (search) permission in directory.

Smilie Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

How to pass value of pwd as variable in SED to replace variable in a script file

Hi all, Hereby wish to have your advise for below: Main concept is I intend to get current directory of my script file. This script file will be copied to /etc/init.d. A string in this copy will be replaced with current directory value. Below is original script file: ... (6 Replies)
Discussion started by: cielle
6 Replies

2. Web Development

Deny from env=env-variable Does not work

(Above from Apache docs). On my system, using: SetEnvIf User-Agent Mozilla IsBad=1 Order allow,deny Allow from all Deny from env=IsBad ...I see that environment variable is set (using phpinfo()) but the page is still served. No errors in the Apache logs. (1 Reply)
Discussion started by: gnurob
1 Replies

3. Shell Programming and Scripting

pwd in a variable

is there anyway i could store the output of pwd that is the path in a variable...? (7 Replies)
Discussion started by: vivek d r
7 Replies

4. AIX

sync samba pwd with aix5.3 pwd

currently, my samba login works just fine. i want my clients to use aix5.3 account to login to samba so they don't have to change samba pwd and aix pwd. i googled, and vi /usr/lib/smb.conf per some of knowledge base, but i could not get to work. aix5.3 and samba thanks in advace..... (2 Replies)
Discussion started by: tjmannonline
2 Replies

5. Shell Programming and Scripting

how to assign a pwd value to a variable

Hi, I want to assign a pwd value to a variable filepath=$pwd Thx in advance (4 Replies)
Discussion started by: vls1210
4 Replies

6. UNIX for Dummies Questions & Answers

PWD env variable

Could you please tell me, which process / file is responsible for the setting of PWD env variable in Solaris Thanks (1 Reply)
Discussion started by: chaandana
1 Replies

7. Solaris

Root ENV is different from users', how to change?

Hello, I'm working on a Solaris 9 machine. I found the root's environment variables (say, $PATH, $ORACLE_HOME, big problem) were set differently from the users'. All regular users use C shell now and share the same environment file stored in /usr/local/config/cshrc.default. Should I just use... (4 Replies)
Discussion started by: alanlh
4 Replies

8. UNIX for Advanced & Expert Users

root pwd expired

Dear friends, I am using linux os . my root passward has expired suddenly. in command prompt iam giving su- and password it is saying that your root password has expired . how to get my root password. anyone pls rep. rajan (3 Replies)
Discussion started by: rajan_ka1
3 Replies

9. HP-UX

root pwd

The root pwd on an hpux11i box was changed by an ex-employee. Is there anyway to reset it without shutting down the machine? If not how can I do it.. Thanks in Advance Brian (6 Replies)
Discussion started by: breigner
6 Replies

10. UNIX for Dummies Questions & Answers

root env

Dear Guys , i installed sun solaries 8 for intel platform . now i want to edit root env or init. files in order to add the follwing : EDITOR=vi export PATH EDITOR export PS1=`uname -n`:\$PWD\> set -o vi alias dir="ls -la|more" alias c=clear stty erase "^H" what file i have to... (13 Replies)
Discussion started by: tamemi
13 Replies
Login or Register to Ask a Question