Search code examples
command-line-interfacezshoh-my-zsh

What is happening when I type 'zsh -manual' in my Zsh shell?


When I type: zsh -manual and press enter my command line moves down to another line with % prepending the blank space. I then cannot exit out of the "mode" my Zsh is running in to return to the Zsh prompt. Can someone please explain what typing Zsh -manual does?

When I get stuck in the % mode I have tried ctrl + x, ctrl + c, ctrl + q, and every other ctrl + <character> I could think of.

// In Zsh shell type:

~ zsh -manual

Press return. You should see:

%

Just a simple explanation is greatly appreciated!


Solution

  • -manual is just the single-letter options -m, -a, -n, -u, -a, -l combined.

    • -m turns on job monitoring, which is on by default for interactive shells anyway, so no effect.
    • -a exports all variables when they're set.
    • -n (aka noexec) turns off execution of commands. Commands are only checked for syntax errors. This effectively makes all the other options irrelevant.
    • -u makes expansion of unset variables an error
    • -l starts a login shell.

    So you just started a new shell that doesn't run any commands (which is probably why the prompt is just the default %). You could get the same effect by using just zsh -n.