Skip to content

Instantly share code, notes, and snippets.

@ino46
Created November 21, 2010 16:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ino46/708890 to your computer and use it in GitHub Desktop.
Save ino46/708890 to your computer and use it in GitHub Desktop.
sh で実行されたときに強制終了
#!bin/bash
a[0]=a 2>/dev/null
if [ $? -ne 0 ]; then
echo 'sh で実行されています。'
exit 1
fi
@ino46
Copy link
Author

ino46 commented Dec 3, 2010

https://gist.github.com/708890/fcf4888c036b5cc57e8338b55a64d6eba4de02c7 は、
zsh でも true になってしまう。zsh の配列は1からなので。

@ino46
Copy link
Author

ino46 commented Feb 12, 2011

今までのはダメダメだった。コレならいけるはず。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment