Last active
August 29, 2015 14:22
-
-
Save okisanjp/8bffc908e94e9d242d38 to your computer and use it in GitHub Desktop.
macのechoをシェルスクリプト内で使う時に -nオプションを使う方法 ref: http://qiita.com/okisanjp/items/7985ddb9b1b00f1617a9
This file contains 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
# シェルスクリプト内で以下のように書くと | |
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] > | |
(´;ω;`)ウッ… |
This file contains 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
$ whereis echo | |
/bin/echo |
This file contains 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
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 |
This file contains 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
#!/bin/sh |
This file contains 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
#!/bin/bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment