Print commands as they execute #85

Closed
wants to merge 2 commits into from
View
11 mac
@@ -7,6 +7,9 @@ successfully() {
echo "Fixing OSX zsh environment bug ..."
successfully sudo mv /etc/{zshenv,zshrc}
+echo "Setting shell to print commands as they execute ..."
+set -x
@gabebw
thoughtbot, inc. member
gabebw added a note Apr 10, 2013

I just ran set -x and got a bunch of crazy output:

$ set -x
$ echo hello
+_zsh_highlight_preexec_hook:2> _ZSH_HIGHLIGHT_PRIOR_BUFFER='' 
+_zsh_highlight_preexec_hook:3> _ZSH_HIGHLIGHT_PRIOR_CURSOR='' 
+-zsh:348> echo hello
hello
+precmd:0> vcs_info prompt 
+....etc

Maybe set -v is better? Check it:

$ set -v
$ echo hello
echo hello
hello

You can turn it off with set +v.

@mxie
thoughtbot, inc. member
mxie added a note Apr 10, 2013

I think the weird output has to do with some of the settings we already have in our .zshrc. I got a different kind of weird output:

$ set -x
+-zsh:2> parse_git_branch
+parse_git_branch:1> ref=+parse_git_branch:1> ref=''
+parse_git_branch:2> [[ -n '' ]]
+-zsh:2> parse_git_uncommitted
+parse_git_uncommitted:1> [[ -d .git ]]
+-zsh:2> parse_git_unstaged
+parse_git_unstaged:1> line=+parse_git_unstaged:1> line=+parse_git_unstaged:1> sed -n '2 p'
+parse_git_unstaged:1> line=''
+parse_git_unstaged:2> [[ -d .git ]]
@joshuaclayton
thoughtbot, inc. member

@mxie I saw similar results - it looks like it's kicking out commands run for the prompt - at least, that's where I started recognizing some of the output when I ran set -x. I'm not familiar enough with zsh to know what was going on here, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+
echo "Fixing permissions ..."
successfully sudo mkdir -p /usr/local
successfully sudo chown -R `whoami` /usr/local
@@ -18,8 +21,8 @@ echo "Installing Homebrew, a good OS X package manager ..."
echo "Putting Homebrew location earlier in PATH ..."
successfully echo "
# recommended by brew doctor
-export PATH='/usr/local/bin:$PATH'" >> ~/.zshenv
- successfully source ~/.zshenv
+export PATH='/usr/local/bin:$PATH'" >> ~/.zshrc
+ successfully source ~/.zshrc
echo "Installing GNU Compiler Collection and dependencies ..."
successfully brew tap homebrew/dupes
@@ -62,6 +65,7 @@ echo "Installing rbenv for changing Ruby versions ..."
echo "Restarting shell as a login shell so path changes take effect to begin using rbenv ..."
exec $SHELL -l
+ set -x
echo "Installing rbenv-gem-rehash so the shell automatically picks up binaries after installing gems with binaries..."
successfully brew install rbenv-gem-rehash
@@ -90,3 +94,6 @@ echo "Installing Heroku CLI client ..."
echo "Installing the heroku-config plugin for pulling config variables locally to be used as ENV variables ..."
successfully heroku plugins:install git://github.com/ddollar/heroku-config.git
+
+echo "Setting shell back to normal; don't print future commands as they execute ..."
+set +x