this is odd as $PWD stores the actual working directory, which might be in some cases the home directory, where .profile resides, but in most not. Correct syntax is
~/.profile or $HOME/.profile
It's used to set the user environment, like variables such as PATH. It's part of a larger file set. Following pseudo code explains the sequence of execution of these files( for the popular bash shell):
Quote:
execute /etc/profile
IF ~/.bash_profile exists THEN
execute ~/.bash_profile
ELIF ~/.bash_login exist THEN
execute ~/.bash_login
ELIF ~/.profile exist THEN
execute ~/.profile
END IF
Following pseudo code explains the sequence of execution of these files( for the popular bash shell):
Sorry to intervene here but this is not quite correct: ~/.profile is the session startup configuration. It is executed by the login process when a user logs into a system. ~/.kshrc, ~/.bashrc and similar files are shell startup configuration scripts and are executed every time a shell instance starts by the shell. As a "session" often consists only of the shell startup, the execution of some commands (which doesn't change the environment) and a logoff this difference is often blurred or doesn't matter at all. But try the following: put a line like:
into your ~/.bashrc and then start a nwe shell. You will see "/foo" added at the end. Now start another shell instance inside the shell - another "/foo" will be added. Start another shell inside this and again another "/foo" will be added. (The same if you put it in your ~/.kshrc and use ksh as your shell.)
Furthermore the location of the startup file for the shell can be changed. Per default it is ~/.bashrc (for bash) or ~/.kshrc (for ksh) as i said but you can control the location of the rc-script by setting the variable "$ENV". I have that usually as the last line of my ~/.profile:
~/.bash_profile and ~/.bash_login are files which only exist in bash. I do not use them because i like all my shell sessions to be configured the same and for that i use ~/.bashrc. Also in my ~/.kshrc the PATH is always set like this:
Notice that the first line resets the PATH completely. This way i make sure pathes are not added several times when i start new shell instances.
Dear all,
I am trying to use 'pwd' command in following way.
current_directory == /dirA/dirB/test/dirC
if ; then
do this
fi
I am not sure how to pass this in command way. Please help!
thanking you,
emily (10 Replies)
I have a script as below.
bash-3.00$ cat test.sh
#!/usr/bin/ksh
path=`pwd`
echo $path
var=$path/temp11
echo $var
If run it is giving output
bash-3.00$ ksh test.sh
//var/tmp/SB2/miscellaneous
//var/tmp/SB2/miscellaneous/temp11 (5 Replies)
Hi all,
Need some help in the following code. (Running this code at cygwin in windows vista)
cat /home/ebanpan/Input_Logs/*.log > /home/ebanpan/Input_Logs/input.log
sed '/^Total/d;/^Bye/d;/^Output has been logged/d' /home/ebanpan/Input_Logs/input.log > /home/ebanpan/output.log
this code... (6 Replies)
I have an export command which exports the file which I specify to the specified location. It asks for an pwd and again to confirm the pwd, can some one help me to pass the pwd thru the script.
cd /opt/var/SecureTransport/bin
xml_export /opt/SecureTransport/var/logs/accounts_log.xml... (3 Replies)
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 3.0.24.0
thanks in advace..... (2 Replies)
Hi,
Can you tell me if there is a command such as pwd which does not give me the absolute NFS pathname i.e. it starts with .autofs? At the moment on the unix when I use the 'pwd' command it always gives me the nfs pathname rather thanthe local pathname of which is what i want, is there an... (4 Replies)
Hi,
I should replace the string DIR_ZERO in the file FILE_OLD with the current directory path in FILE_NEW by using something like this:
sed "s/DIR_ZERO/'$(pwd)'/" FILE_OLD > FILE_NEW
but it doesn't work and I don't understand why...:confused:
Thanks in advance!!!
Giordano Bruno (2 Replies)
Hello everyone - First post here,
I'm trying to connect to an anonymous ftp server and I am told by the server admin that I cannot have access to the "print working directory" command. I need to have access to this command in order for my (and my clients) preferred ftp client to connect. (the... (9 Replies)
Probably a very straight forward question but please be easy on me, I am v. new to UNIX!
A script that I have runs the line
tmp=`pwd -H`
It works fine, but I needed to make a couple of other changes to the script, nowhere near this line but now this line reports:
pwd: A specified flag... (2 Replies)
I am running NIS, NFS and automount.
If I execute
% cd /xyz/data1
% pwd
I get different results depending on the operating system.
On SGI running Irix 6.5.x pwd returns /xyz/data1
On Redhat Linux 7.3 pwd returns /xyz/data1
BUT
On Tru64 UNIX the pwd command returns... (1 Reply)