Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Print commands as they execute #85

Closed
wants to merge 2 commits into from

6 participants

@croaky
Admin

No description provided.

@jferris
Admin

Do we need to set +x at some point?

@croaky
Admin

@jferris Good point. Just made a few adjustments, including some echos to explain what's happening.

Ready for another review.

@gabebw gabebw commented on the diff
@@ -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 Admin
gabebw added a note

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 Admin
mxie added a note

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 Admin

@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
@jferris
Admin

I'm not sure what will happen if something fails in the middle there. I don't know when (if ever) that would reset.

@calebthompson

You could add set +v to the sad path of successfully, which would at least catch those failures.

@croaky
Admin

I'm not sure what will happen if something fails in the middle there. I don't know when (if ever) that would reset.

Hmm, yeah. I don't feel particularly passionate about this change so I'm going to close without merging.

Thanks, all.

@croaky croaky closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 10, 2013
  1. @croaky

    Print commands as they execute

    croaky authored
  2. @croaky

    Finish zshenv -> zshrc move

    croaky authored
    Started in 1ed31e7
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 2 deletions.
  1. +9 −2 mac
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 Admin
gabebw added a note

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 Admin
mxie added a note

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 Admin

@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
Something went wrong with that request. Please try again.