mirror of https://github.com/geohot/qira
Only run readlink on a symlink on OS X
readlink does not print anything if the argument is not actually a symlink. This change allows running the tool from the current directory with `./qira`.
This commit is contained in:
parent
1f62559134
commit
a243851eff
6
qira
6
qira
|
@ -3,7 +3,11 @@ unamestr=$(uname)
|
|||
if [[ "$unamestr" == 'Linux' ]]; then
|
||||
DIR=$(dirname $(readlink -f $0))
|
||||
elif [[ "$unamestr" == "Darwin" ]]; then
|
||||
DIR=$(dirname $(readlink $(which $0)))
|
||||
cmd=$(which "$0")
|
||||
if [ -L "$cmd" ]; then
|
||||
cmd=$(readlink "$cmd")
|
||||
fi
|
||||
DIR=$(dirname "$cmd")
|
||||
else
|
||||
echo "Only Linux and Mac OS X are supported!"
|
||||
exit
|
||||
|
|
Loading…
Reference in New Issue