How to detect the current directory in which I run my shell script?

shell

Solution

what shell? What operating system?

For starters try

man pwd
$PWD

Problem

How may I detect the name of the directory (or better yet the entire path) in which my shell script is run?

Original source

Related problems