LoginSignup
0
0

More than 5 years have passed since last update.

cshでスクリプト配置場所を取得

Last updated at Posted at 2016-11-01

shell書いているとスクリプト配置場所を取得したい事があると思う
"shell カレントディレクトリ" 等で調べると以下の例が出てくる

echo $(cd $(dirname $0) && pwd)

実行すると

syntax error at line 2: `(' unexpected

となってしまった
これは cshell で動いていたのが原因で
cshellの場合は以下のように書けば動いた

echo `cd \`dirname $0\` && pwd`

動いているshellは以下で確認できる

$ echo $SHELL
/bin/csh
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0