mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-12-01 03:02:42 +01:00
Resolve arc location through symlinks-of-symlinks, etc
Summary: Stole this from stackoverflow; seems to work? http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in Test Plan: Ran a symlink to bin/arc. Reviewers: btrahan, zeeg Reviewed By: btrahan CC: aran, epriestley Maniphest Tasks: T124 Differential Revision: https://secure.phabricator.com/D1968
This commit is contained in:
parent
e8accf4b9f
commit
7c3f8b3041
1 changed files with 10 additions and 2 deletions
12
bin/arc
12
bin/arc
|
@ -1,7 +1,15 @@
|
||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
# NOTE: This file is a wrapper script instead of a symlink so it will work in
|
# NOTE: This file is a wrapper script instead of a symlink so it will work in
|
||||||
# the Git Bash environment in Windows.
|
# the Git Bash environment in Windows.
|
||||||
|
|
||||||
exec `dirname $0`/../scripts/arcanist.php $@
|
# Do bash magic to resolve the real location of this script through aliases,
|
||||||
|
# symlinks, etc.
|
||||||
|
SOURCE="${BASH_SOURCE[0]}";
|
||||||
|
while [ -h "$SOURCE" ]; do
|
||||||
|
SOURCE="$(readlink "$SOURCE")";
|
||||||
|
done;
|
||||||
|
DIR="$(cd -P "$(dirname "$SOURCE")" && pwd)"
|
||||||
|
|
||||||
|
exec $DIR/../scripts/arcanist.php $@
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue