Last active
October 30, 2023 08:48
-
-
Save okinjp/b58589c9f987fae11eb5a053b14929cf to your computer and use it in GitHub Desktop.
簡易に絶対パスを返すスクリプト
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 characters
#!/usr/bin/env bash | |
# 第一引数がパスで第二引数以降は単純に引き渡せればいい場合は$1の代わりに$@も可 | |
PATHTO = $1 | |
if [[ "$PATHTO" = "/"* ]] || [[ "$PATHTO" = "~"* ]];then | |
PATHPREFIX="" | |
else | |
PATHPREFIX="$(pwd)/" | |
fi | |
echo "$PATHPREFIX$PATHTO" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment