i-bash/tests/history.tests

114 lines
1.3 KiB
Text
Raw Normal View History

1997-06-05 14:59:13 +00:00
trap 'rm /tmp/newhistory' 0
1998-04-17 19:52:44 +00:00
# bad options
history -x
# cannot use -r and -w at the same time
history -r -w /dev/null
# bad option
fc -v
2005-12-07 14:08:12 +00:00
unset HISTFILESIZE
1998-04-17 19:52:44 +00:00
# all of these should result in an empty history list
history -c
history -r /dev/null
history -n /dev/null
1997-06-05 14:59:13 +00:00
history -c
HISTFILE=history.list
HISTCONTROL=ignoreboth
HISTIGNORE='&:history*:fc*'
HISTSIZE=32
shopt -s cmdhist
set -o history
history
fc -l
fc -nl
fc -lr
fc -nlr
history -s "echo line for history"
history
history -p '!!'
fc -nl
HISTFILE=/tmp/newhistory
history -a
echo displaying \$HISTFILE after history -a
cat $HISTFILE
history
history -w
cat $HISTFILE
history -s "echo line 2 for history"
history
history -p '!e'
history -p '!!'
# this should show up as one history entry
for x in one two three
do
:
done
history
# just a basic test. a full test suite for history expansion should be
# created
set -H
!!
!e
unset HISTSIZE
unset HISTFILE
fc -l 4
fc -l 4 8
1998-04-17 19:52:44 +00:00
fc -l one=two three=four 502
1997-06-05 14:59:13 +00:00
history 4
shopt -so history
shopt -s expand_aliases
alias r="fc -s"
echo aa ab ac
r a=x
1998-04-17 19:52:44 +00:00
r x=4 b=8
1997-06-05 14:59:13 +00:00
# this had better fail with `no command found'
r cc
unalias -a
alias
2009-01-12 13:36:28 +00:00
# these two blocks had better both result in the same output
echo aa
echo bb
echo cc
fc -e cat
echo aa
echo bb
echo cc
fc -e cat -1
1997-06-05 14:59:13 +00:00
set +o history
shopt -q -o history
echo $?
2009-01-12 13:36:28 +00:00
${THIS_SH} ./history1.sub
2011-11-21 20:51:19 -05:00
${THIS_SH} ./history2.sub