Bug 55557 - history -s ineffective in .bash_profile in for or case statement
history -s ineffective in .bash_profile in for or case statement
Status: CLOSED CURRENTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: bash (Show other bugs)
7.2
i386 Linux
medium Severity low
: ---
: ---
Assigned To: Tim Waugh
Ben Levenson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-11-01 17:01 EST by Rudolph T Maceyko
Modified: 2007-04-18 12:37 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-09-25 21:54:55 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Rudolph T Maceyko 2001-11-01 17:01:21 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.2) Gecko/20010809

Description of problem:
A construct such as this in .bash_profile should replace the last history
entry so that pressing c-p at the first prompt recalls the command "blah":

  if true; then
    history -s "blah"
    echo status=$?; history 1
  fi

Under bash-2.04-21 and prior versions (back to whichever version introduced
"history -s") this worked.  Starting with bash-2.05-8 it does not work.

Interestingly, if you change the expression so "history -s blah" is invoked
on its own, it *does* work, even with bash-2.05-8:

  history -s "blah"
  echo status=$?; history 1

Note again that the problem manifests itself in the dot files.  If you type
these commands interactively they will always succeed.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. mkdir tmphome
2. cat >>tmphome/.bash_profile<<END
if true; then
history -s "blah"
echo status=$?; history 1
fi
END
3. HOME=$PWD/tmphome bash --login
	

Actual Results:  bash-2.05$ mkdir tmphome
bash-2.05$ cat >>tmphome/.bash_profile<<END
> if true; then
> history -s "blah"
> echo status=$?; history 1
> fi
> END
bash-2.05$ HOME=$PWD/tmphome bash --login
status=0
bash-2.05$


Expected Results:  bash-2.04$ mkdir tmphome
bash-2.04$ cat >>tmphome/.bash_profile<<END
> if true; then
> history -s "blah"
> echo status=$?; history 1
> fi
> END
bash-2.04$ HOME=$PWD/tmphome bash --login
status=0
    1  blah
bash-2.04$



Additional info:

works:

  bash-2.04$ rpm -q bash redhat-release
  bash-2.04-21
  redhat-release-7.1-1

doesn't work:

  bash-2.05$ rpm -q bash redhat-release
  bash-2.05-8
  redhat-release-7.2-1

All errata are applied on both systems.
Comment 1 Tim Waugh 2002-10-11 07:05:21 EDT
This seems to be fixed in Red Hat Linux 8.0.

Note You need to log in before you can comment on or make changes to this bug.