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 of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.