3

In bash, to rerun the last command, you can use !!, it prints what it is going to run, then runs it. Observe below:

bash-3.2$ echo hello <return>
hello
bash-3.2$ !! <return>
echo hello
hello
bash-3.2$ 

Now, this is how zsh is behaving on my machine, note that that pressing return after !! just prints the command, and does not run it. Is there a way to emulate bash's behaviour in zsh?

zsh$  echo hello <return>
hello
zsh$  !! <return>
zsh$  echo hello <return>
hello
zsh$   

2 Answers 2

4

This is caused by the hist_verify option being set to true.

1
  • 2
    "setopt No_HIST_VERIFY" is how to turn it off.
    – mcr
    Sep 25, 2013 at 2:34
1

Add setopt No_HIST_VERIFY to .zshrc.

(I placed it at the bottom of the file)

To test that it works you can either:

  • run source .zshrc in the same terminal window
  • or open a new terminal window

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .