Why do errors like "hist: 1-0: invalid range" generate while executing the script from ksh if ~.sh_history file is empty?

Solution Unverified - Updated -

Issue

  • If the ~.sh_history file is empty, and trying to run the history command from the terminal is not giving any error, but if one run the same command from the script, is giving the below error.
./test.sh[1]: hist: 1-0: invalid range
  • Why does ksh behave differently for the same command?

Environment

  • Red Hat Enterprise Linux 6.5
  • ksh

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content