Bug 55557 - history -s ineffective in .bash_profile in for or case statement
Summary: history -s ineffective in .bash_profile in for or case statement
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: bash
Version: 7.2
Hardware: i386
OS: Linux
medium
low
Target Milestone: ---
Assignee: Tim Waugh
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-11-01 22:01 UTC by Rudolph T Maceyko
Modified: 2007-04-18 16:37 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2002-09-26 01:54:55 UTC
Embargoed:


Attachments (Terms of Use)

Description Rudolph T Maceyko 2001-11-01 22:01:21 UTC
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 11:05:21 UTC
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.