0

when I open up my terminal in Mac OS, the terminal prints at the top

   /.zshrc:export:97: not valid in this context -w

I modified a line in my /.zshrc file by following strict instructions online and using nano. I think I may have accidentally messed something up.

I opened the file on sublime, and the relevant lines are

 96 export PATH=$PATH:$HOME/bin
 97 export EDITOR='subl' -w
 98 export PATH=$PATH:$HOME/bin
 99 export EDITOR='subl' -w

I have no idea how to fix this.

  • 1
    if -w is a flag to subl it probably should instead be export EDITOR='subl -w' though some things may not like a space when they go to exec that program – thrig Jan 9 at 0:20
  • do you know why there is a copy of lines 96/97 (and if 98/99 are necessary? – Rafael Vergnaud Jan 9 at 0:25
0

An assignment with export looks like this:

export variable=value

You may not use

export variable=value other_value

without quoting the complete string value other_value.

In your case, use

export EDITOR='subl -w'

In comments, you ask whether the duplication of the lines is necessary. No, the duplication is not necessary.

For the export EDITOR line, the duplicated line is a no-op (it just re-does the assignment and the export). For the export PATH line, the second time you run the same statement, you will add the path $HOME/bin again to the end of the value of PATH. This will have no practical consequences, but may slow down finding executables by a few fractions of a second.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.