Last active
June 5, 2019 13:33
Revisions
-
AndersDJohnson revised this gist
Apr 1, 2013 . 1 changed file with 25 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ # from: https://github.com/zimbatm/direnv/blob/3bb35d375331fca89614f0015b2a6cd21688ab79/bin/direnv # usage: abs_dirname $filename # finds the original $filename path and prints it's absolute folder path abs_dirname() { prev_path="$1" # Resolve the symlink(s) recursively while true; do abs_path=`readlink "$prev_path"` if [ -z "$abs_path" ]; then abs_path="$prev_path" break else prev_path="$abs_path" fi done unset prev_path # Get the absolute directory of the final $abs_path orig_dir=`pwd` cd `dirname "$abs_path"` # prints an absolute path here pwd cd "$orig_dir" unset abs_path orig_dir } -
AndersDJohnson renamed this gist
Feb 11, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
AndersDJohnson revised this gist
Feb 11, 2013 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,4 @@ #!/bin/bash BASEDIR=$(dirname "$(readlink -f $0)") -
AndersDJohnson revised this gist
Jan 13, 2013 . 1 changed file with 4 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,7 @@ #!/bin/bash CURDIR=${PWD} BASEDIR="$( cd "$( dirname "$(realpath $BASH_SOURCE)" )" && pwd )" # This didn't support symlinked scripts # BASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -
AndersDJohnson created this gist
Dec 9, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,4 @@ #!/bin/bash CURDIR=${PWD} BASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"