Skip to content

Instantly share code, notes, and snippets.

@rickhull
Last active December 24, 2015 17:29
Show Gist options
  • Save rickhull/cead1daa0ec979bad29a to your computer and use it in GitHub Desktop.
Save rickhull/cead1daa0ec979bad29a to your computer and use it in GitHub Desktop.
containing dir, in bash
rwh@UbuntuVM:~/git$ ../test.bash
PWD=/home/rwh/git
DIR=/home/rwh
dirname=..
#!/bin/bash
echo PWD=$PWD
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo DIR=$DIR
echo dirname=`dirname $0`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment