Whenever I have to write scripts or change my .zshrc file for example, it often breaks whenever I type an " (quotation mark) -- it gets automatically converted to a italic quotation mark: and it doesn't get recognized by the shell when I run the script. I often have to manually copy/paste a clean quotation mark (") when writing things that are run by the shell.

I am on MacOS Catalina 10.15.6, using zsh.

Any idea on how to solve this?

  • 2
    An apostrophe is ' or . Your characters are "quotation marks", or simply "quotes". – marcelm Sep 22 at 14:17
  • 5
    What tool to you use to write your scripts? Text-oriented tools (such as TextEdit) will indeed have auto-correction activated. Code-oriented tools (such as Xcode) won't. And of course any tools in a terminal session, including vi. – jcaron Sep 22 at 15:09
  • 1
    You will also run into issues with double-dashes (--) getting turned into em-dashes (—), which will break commandline flags. I strongly recommend using a text editor designed for code, rather than prose, when editing scripts. If you want a simple graphical text editor for OS X which is suitable for use when editing code/scripts, popular choices are Atom or Sublime Text. – Glenn Willen Sep 22 at 20:24

These aren't italic, they're the "typographically correct" open- and close-quotes. But they are pretty useless in a shell

To disable them globally: System Preferences > Keyboard > Text > uncheck "Use smart quotes and dashes"

To disable them in-application, if the menu is available, deselect "Smart Quotes" in the Edit > Substitutions menu of your application

| improve this answer | |
  • I think this misses the root cause which is using a code editor as GlennWillen commented – FreeSoftwareServers Sep 23 at 1:23
  • 1
    My answer is intended to apply to OP's current workflow. If they want to take the time to learn a better text editor, that's great! But "use a different editor" doesn't cover all possible circumstances, like consider a browser-based REPL – Fox Sep 23 at 1:52

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.