Permalink
Browse files

Replace all uses of echo with printf

The echo builtin is very unportable and should be avoided. More
information can be found here:

http://wiki.bash-hackers.org/commands/builtin/echo
  • Loading branch information...
1 parent 155c357 commit 5765e1ec8ba2f0d205e46e63e55c5176358578ec @pbrisbin pbrisbin committed Mar 4, 2014
Showing with 15 additions and 17 deletions.
  1. +1 −1 common-components/check-home-bin
  2. +3 −4 linux
  3. +2 −3 linux-components/rbenv
  4. +5 −5 mac
  5. +2 −2 mac-components/homebrew
  6. +2 −2 mac-components/rbenv
View
2 common-components/check-home-bin
@@ -7,6 +7,6 @@ if [ ! -f "$HOME/.zshrc" ]; then
fi
if [[ ":$PATH:" != *":$HOME/.bin:"* ]]; then
- echo 'export PATH="$HOME/.bin:$PATH"' >> ~/.zshrc
+ printf 'export PATH="$HOME/.bin:$PATH"\n' >> ~/.zshrc
export PATH="$HOME/.bin:$PATH"
fi
View
7 linux
@@ -22,7 +22,7 @@ if [ ! -f "$HOME/.zshrc" ]; then
fi
if [[ ":$PATH:" != *":$HOME/.bin:"* ]]; then
- echo 'export PATH="$HOME/.bin:$PATH"' >> ~/.zshrc
+ printf 'export PATH="$HOME/.bin:$PATH"\n' >> ~/.zshrc
export PATH="$HOME/.bin:$PATH"
fi
### end common-components/check-home-bin
@@ -114,9 +114,8 @@ if [[ ! -d "$HOME/.rbenv" ]]; then
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
if ! grep -qs "rbenv init" ~/.zshrc; then
- echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc
-
- echo 'eval "$(rbenv init - --no-rehash)"' >> ~/.zshrc
+ printf 'export PATH="$HOME/.rbenv/bin:$PATH"\n' >> ~/.zshrc
+ printf 'eval "$(rbenv init - --no-rehash)"\n' >> ~/.zshrc
fi
export PATH="$HOME/.rbenv/bin:$PATH"
View
5 linux-components/rbenv
@@ -3,9 +3,8 @@ if [[ ! -d "$HOME/.rbenv" ]]; then
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
if ! grep -qs "rbenv init" ~/.zshrc; then
- echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc
-
- echo 'eval "$(rbenv init - --no-rehash)"' >> ~/.zshrc
+ printf 'export PATH="$HOME/.rbenv/bin:$PATH"\n' >> ~/.zshrc
+ printf 'eval "$(rbenv init - --no-rehash)"\n' >> ~/.zshrc
fi
export PATH="$HOME/.rbenv/bin:$PATH"
View
10 mac
@@ -22,7 +22,7 @@ if [ ! -f "$HOME/.zshrc" ]; then
fi
if [[ ":$PATH:" != *":$HOME/.bin:"* ]]; then
- echo 'export PATH="$HOME/.bin:$PATH"' >> ~/.zshrc
+ printf 'export PATH="$HOME/.bin:$PATH"\n' >> ~/.zshrc
export PATH="$HOME/.bin:$PATH"
fi
### end common-components/check-home-bin
@@ -48,8 +48,8 @@ if ! which brew &>/dev/null; then
if ! grep -qs "recommended by brew doctor" ~/.zshrc; then
fancy_echo "Put Homebrew location earlier in PATH ..."
- echo "\n# recommended by brew doctor" >> ~/.zshrc
- echo "export PATH=\"/usr/local/bin:\$PATH\"\n" >> ~/.zshrc
+ printf '\n# recommended by brew doctor\n' >> ~/.zshrc
+ printf 'export PATH="/usr/local/bin:$PATH"\n' >> ~/.zshrc
export PATH="/usr/local/bin:$PATH"
fi
else
@@ -95,8 +95,8 @@ fancy_echo "Installing rbenv, to change Ruby versions ..."
brew install rbenv
if ! grep -qs "rbenv init" ~/.zshrc; then
- echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc
- echo 'eval "$(rbenv init - --no-rehash)"' >> ~/.zshrc
+ printf 'export PATH="$HOME/.rbenv/bin:$PATH"\n' >> ~/.zshrc
+ printf 'eval "$(rbenv init - --no-rehash)"\n' >> ~/.zshrc
fancy_echo "Enable shims and autocompletion ..."
eval "$(rbenv init -)"
View
4 mac-components/homebrew
@@ -4,8 +4,8 @@ if ! which brew &>/dev/null; then
if ! grep -qs "recommended by brew doctor" ~/.zshrc; then
fancy_echo "Put Homebrew location earlier in PATH ..."
- echo "\n# recommended by brew doctor" >> ~/.zshrc
- echo "export PATH=\"/usr/local/bin:\$PATH\"\n" >> ~/.zshrc
+ printf '\n# recommended by brew doctor\n' >> ~/.zshrc
+ printf 'export PATH="/usr/local/bin:$PATH"\n' >> ~/.zshrc
export PATH="/usr/local/bin:$PATH"
fi
else
View
4 mac-components/rbenv
@@ -2,8 +2,8 @@ fancy_echo "Installing rbenv, to change Ruby versions ..."
brew install rbenv
if ! grep -qs "rbenv init" ~/.zshrc; then
- echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc
- echo 'eval "$(rbenv init - --no-rehash)"' >> ~/.zshrc
+ printf 'export PATH="$HOME/.rbenv/bin:$PATH"\n' >> ~/.zshrc
+ printf 'eval "$(rbenv init - --no-rehash)"\n' >> ~/.zshrc
fancy_echo "Enable shims and autocompletion ..."
eval "$(rbenv init -)"

0 comments on commit 5765e1e

Please sign in to comment.