1

According to the docs I can tell the zsh history to print lines in a range. The docs say "history [first [last]]" I've tried "history a b" but that gives a too many arguments error.

I've also tried hundreds of other things same results. Can someone post an example of a working history with range?

4
  • 1
    That sounds like a bash error. Are you sure you're using zsh? What do echo "$ZSH_VERSION" and echo "$BASH_VERSION" tell you? Aug 19 '13 at 5:48
  • 4
    Works fine here: echo "$ZSH_VERSION"; history 1008 1009 yields 4.3.10 1008 history 1000 1008 1009 history 1008 1009 Aug 19 '13 at 5:54
  • ZSH_VERSION is 5.0.2 BASH_VERSION is null. Also I am using Oh-my-zsh. Aug 19 '13 at 7:00
  • What happens when you remove Oh-my-zsh? (You should remove it permanently, FWIW).
    – jasonwryan
    Aug 20 '13 at 0:47
0

Examples as requested.

Fails when attempting using bash:

mintvm ~ # echo $BASH_VERSION
4.3.11(1)-release
mintvm ~ # echo $ZSH_VERSION

mintvm ~ # history 1 5
-su: history: too many arguments
mintvm ~ #

Works when using zsh:

mintvm ~ # zsh
mintvm# echo $BASH_VERSION

mintvm# echo $ZSH_VERSION
5.0.2
mintvm# history 1 5
    1  echo $BASH_VERSION
    2  echo $ZSH_VERSION
    3  history 1 5
mintvm#
0

zsh

fc -l -5      # 5 most recent 
fc -l 1 5     # 5 oldest 
fc -l -10 -5  # 10th newest to 5 newest

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.