Skip to content

Instantly share code, notes, and snippets.

@okisanjp
Last active August 29, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save okisanjp/8bffc908e94e9d242d38 to your computer and use it in GitHub Desktop.
Save okisanjp/8bffc908e94e9d242d38 to your computer and use it in GitHub Desktop.
macのechoをシェルスクリプト内で使う時に -nオプションを使う方法 ref: http://qiita.com/okisanjp/items/7985ddb9b1b00f1617a9
# シェルスクリプト内で以下のように書くと
echo -n "Are you sure you want to exit the server? [y/n] > "
# 実行時
-n Are you sure you want to exit the server? [y/n] >
(´;ω;`)ウッ…
$ whereis echo
/bin/echo
if [ `uname` = "Darwin" ]; then
/bin/echo -n "Are you sure you want to exit the server? [y/n] > "
else
echo -n "Are you sure you want to exit the server? [y/n] > "
fi
#!/bin/bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment