Changes between Initial Version and Version 1 of Shell


Ignore:
Timestamp:
08/26/15 09:34:44 (9 years ago)
Author:
sky
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Shell

    v1 v1  
     1= Shell =
     2
     3== Get Current Path ==
     4
     5{{{
     6#!/bin/bash
     7
     8function get_current_path {
     9    SOURCE=${BASH_SOURCE[0]}
     10    DIR=$( dirname "$SOURCE" )
     11    if [ -h "$SOURCE" ]; then
     12        SOURCE=$(readlink "$SOURCE")
     13        [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
     14        DIR=$( cd -P "$( dirname "$SOURCE"  )" && pwd )
     15      else
     16        DIR=$( cd -P "$( dirname "$SOURCE" )" && pwd )
     17    fi
     18    echo $DIR
     19}
     20
     21CI_DIR=$( get_current_path )
     22}}}
     23