Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print commands as they execute #85

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 9 additions & 2 deletions mac
Expand Up @@ -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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ]]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.


echo "Fixing permissions ..."
successfully sudo mkdir -p /usr/local
successfully sudo chown -R `whoami` /usr/local
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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