Difference beween $PATH and $PWD


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Difference beween $PATH and $PWD
# 1  
Old 01-29-2013
Difference beween $PATH and $PWD

Hi

i am in learning phase of unix.
i am not able to understand the difference between $PATH and $PWD
below the the output which i am getting .
Code:
$ echo $PATH 
/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/home/guest/khare/bin
$ echo $PWD
/home/guest/khare
$

Regards,
Scriptor
# 2  
Old 01-29-2013
$PWD is the current working directory, also called cwd or wd, which is used on relative file paths -- those that do not begin with '/'.

$PATH is many directories separated by ':' characters. $PATH is used by the execvp() system call and its variations to search for commands, so you can run all the commands in /usr/bin like ls without typing /usr/bin/ls. Executable commands can be scripts or compiled programs, but must have execute permission to you and scripts must have a #! first line to designate the interpreter by full path and one optional parameter. The first directory with the right named executable wins, so order can be important. There are many similar variables, like MANPATH for finding man pages, using this notation.

Last edited by DGPickett; 01-29-2013 at 03:26 PM..
This User Gave Thanks to DGPickett For This Post:
# 3  
Old 01-29-2013
There's no confusion, the two variables hold different values that represent different things, however if you need a trick to tell them apart, PATH is the path to be searched for executables when you invoke an executable without a full path from root whereas PWD is the Present Working Directory, simples Smilie
This User Gave Thanks to Skrynesaver For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

What is the difference ../directory path and ./directory path in ksh?

What is the difference ../directory path and ./directory path in ksh? (1 Reply)
Discussion started by: TestKing
1 Replies

2. UNIX for Advanced & Expert Users

Command to see the logical volume path, device mapper path and its corresponding dm device path

Currently I am using this laborious command lvdisplay | awk '/LV Path/ {p=$3} /LV Name/ {n=$3} /VG Name/ {v=$3} /Block device/ {d=$3; sub(".*:", "/dev/dm-", d); printf "%s\t%s\t%s\n", p, "/dev/mapper/"v"-"n, d}' Would like to know if there is any shorter method to get this mapping of... (2 Replies)
Discussion started by: royalibrahim
2 Replies

3. UNIX for Beginners Questions & Answers

$pwd

Hi all,when I cd to an environment variable "cd $MYDIR, if I type pwd, I don't the path to the environment variable dir I cd to. Appreciate the help, regards..Abbya (5 Replies)
Discussion started by: abbya
5 Replies

4. Shell Programming and Scripting

Search text beween tags and write to file using awk

Hi Friends, I have a very big text file, that has code for multiple functions. I have scan through the file and write each function in seperate file. All functions starts with BEGIN DSFNC Identifier "ABCDDataValidationfnc" and ends with END DSFNC I need create a file(using identifier)... (2 Replies)
Discussion started by: anandapani
2 Replies

5. HP-UX

[Solved] how to compress and uncompress the files beween HP UX and Linux OS

I have file with large size in HP-UX os. I need to compress on HP-UX and ftp to linux server and i need to uncompress the files. How can i do this? Any help is highly appreciated.. (3 Replies)
Discussion started by: govindts
3 Replies

6. UNIX for Dummies Questions & Answers

What is difference between pwd and .

Difference between pwd (present working directory) and . (current working directory). (2 Replies)
Discussion started by: dhami111
2 Replies

7. 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 3.0.24.0 thanks in advace..... (2 Replies)
Discussion started by: tjmannonline
2 Replies

8. Shell Programming and Scripting

Need to print the expansion of the found string (the expansion is beween two delimiters '-' , '||'

Hi , could anyone help me out with this problem. sample.txt has this content : u001- this is used for project1 || u002- this is used for p2|| not to be printed u003- this is used for project3 || u004- this is used for p4 || u005- this is used for project5 || u006- this is used for p6... (9 Replies)
Discussion started by: Balaji PK
9 Replies

9. UNIX for Advanced & Expert Users

echo ${PWD#${PWD%/*/*}/}

Can anyone explain this in detail ... echo ${PWD#${PWD%/*/*}/} Thanks in Advance (1 Reply)
Discussion started by: sakthi.abdullah
1 Replies

10. UNIX for Dummies Questions & Answers

pwd

Home directory mounted on one local system as /home/username, same directory mounted on a remote system as /home/engr/username. How to use command to use remote host pwd. For example rsh <remote host> ls -l ~pwd (2 Replies)
Discussion started by: bugsandbunny
2 Replies
Login or Register to Ask a Question