Blogged by Ujihisa. Standard methods of programming and thoughts including Clojure, Vim, LLVM, Haskell, Ruby and Mathematics written by a Japanese programmer. github/ujihisa

Friday, February 5, 2010

How To Check If You Have The Command

For example, to assume you have the command svn and you don't have the command svn1:

which svn >&/dev/null
if [ $? == 0 ]; then
  echo You have svn
fi

which svn1 >&/dev/null
if [ $? == 1 ]; then
  echo You don\'t have svn1
fi

No comments:

Post a Comment

Followers