0

How is useful env in this install.sh script:

env git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git $ZSH || {
  printf "Error: git clone of oh-my-zsh repo failed\n"
  exit 1
}

Is it because of the variable $ZSH?

1 Answer 1

2

The $ZSH variable is defined a couple of lines above so it is not the purpose here.

The env command can be used to run a command/program in a modified environment, but as there are no additional variables specified here, the command will be run in an unmodified environment.

The main purpose in this case is to get rid of aliases and functions that could shadow the command to be run.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.