getting pwd of script

view story

http://www.unix.com – how can i get the absolute path of whatever directory a script and/or command is in when it is run? i want to know the directory. say for instance, if i were to run the "who" command, i want to know exaclty where the who command is located. if a user ran a script, i want to know where there script is located. can this be done in a script? shell: bash os: linux / sunos (HowTos)