Skip to content

Commit

Permalink
Replace all uses of echo with printf
Browse files Browse the repository at this point in the history
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
pbrisbin committed Mar 4, 2014
1 parent 155c357 commit 5765e1e
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion common-components/check-home-bin
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 3 additions & 4 deletions linux
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
5 changes: 2 additions & 3 deletions linux-components/rbenv
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
10 changes: 5 additions & 5 deletions mac
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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 -)"
Expand Down
4 changes: 2 additions & 2 deletions mac-components/homebrew
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions mac-components/rbenv
Original file line number Diff line number Diff line change
Expand Up @@ -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 -)"
Expand Down

0 comments on commit 5765e1e

Please sign in to comment.