📄 history.t
字号:
# Not tested yet:# - commands in history file are not numbered negatively# (and a few hundred other things)name: history-basicdescription: See if we can test history at allarguments: !-i!env-setup: !ENV=./Env!HISTFILE=hist.file!file-setup: file 644 "Env" PS1=Xstdin: echo hi fc -lexpected-stdout: hi 1 echo hiexpected-stderr-pattern: /^X*$/---name: history-e-minus-1description: Check if more recent command is executedarguments: !-i!env-setup: !ENV=./Env!HISTFILE=hist.file!file-setup: file 644 "Env" PS1=Xstdin: echo hi echo there fc -e -expected-stdout: hi there thereexpected-stderr-pattern: /^X*echo there\nX*$/---name: history-e-minus-2description: Check that repeated command is printed before command is re-executed.arguments: !-i!env-setup: !ENV=./Env!HISTFILE=hist.file!file-setup: file 644 "Env" PS1=Xstdin: exec 2>&1 echo hi echo there fc -e -expected-stdout-pattern: /X*hi\nX*there\nX*echo there\nthere\nX*/expected-stderr-pattern: /^X*$/---name: history-e-minus-3description: fc -e - fails when there is no history (ksh93 has a bug that causes this to fail) (ksh88 loops on this)arguments: !-i!env-setup: !ENV=./Env!HISTFILE=hist.file!file-setup: file 644 "Env" PS1=Xstdin: fc -e - echo okexpected-stdout: okexpected-stderr-pattern: /^X*.*:.*history.*\nX*$/---name: history-e-minus-4description: Check if "fc -e -" command output goes to stdout.arguments: !-i!env-setup: !ENV=./Env!HISTFILE=hist.file!file-setup: file 644 "Env" PS1=Xstdin: echo abc fc -e - | (read x; echo "A $x") echo okexpected-stdout: abc A abc okexpected-stderr-pattern: /^X*echo abc\nX*/---name: history-e-minus-5description: fc is replaced in history by new command.arguments: !-i!env-setup: !ENV=./Env!HISTFILE=hist.file!file-setup: file 644 "Env" PS1=Xstdin: echo abc def echo ghi jkl fc -e - echo fc -l 2 4expected-stdout: abc def ghi jkl ghi jkl 2 echo ghi jkl 3 echo ghi jkl 4 fc -l 2 4expected-stderr-pattern: /^X*echo ghi jkl\nX*$/---name: history-list-1description: List lists correct range (ksh88 fails 'cause it lists the fc command)arguments: !-i!env-setup: !ENV=./Env!HISTFILE=hist.file!file-setup: file 644 "Env" PS1=Xstdin: echo line 1 echo line 2 echo line 3 fc -l -- -2expected-stdout: line 1 line 2 line 3 2 echo line 2 3 echo line 3expected-stderr-pattern: /^X*$/---name: history-list-2description: Lists oldest history if given pre-historic number (ksh93 has a bug that causes this to fail) (ksh88 fails 'cause it lists the fc command)arguments: !-i!env-setup: !ENV=./Env!HISTFILE=hist.file!file-setup: file 644 "Env" PS1=Xstdin: echo line 1 echo line 2 echo line 3 fc -l -- -40expected-stdout: line 1 line 2 line 3 1 echo line 1 2 echo line 2 3 echo line 3expected-stderr-pattern: /^X*$/---name: history-list-3description: Can give number `options' to fcarguments: !-i!env-setup: !ENV=./Env!HISTFILE=hist.file!file-setup: file 644 "Env" PS1=Xstdin: echo line 1 echo line 2 echo line 3 echo line 4 fc -l -3 -2expected-stdout: line 1 line 2 line 3 line 4 2 echo line 2 3 echo line 3expected-stderr-pattern: /^X*$/---name: history-list-4description: -1 refers to previous commandarguments: !-i!env-setup: !ENV=./Env!HISTFILE=hist.file!file-setup: file 644 "Env" PS1=Xstdin: echo line 1 echo line 2 echo line 3 echo line 4 fc -l -1 -1expected-stdout: line 1 line 2 line 3 line 4 4 echo line 4expected-stderr-pattern: /^X*$/---name: history-list-5description: List command stays in historyarguments: !-i!env-setup: !ENV=./Env!HISTFILE=hist.file!file-setup: file 644 "Env" PS1=Xstdin: echo line 1 echo line 2 echo line 3 echo line 4 fc -l -1 -1 fc -l -2 -1expected-stdout: line 1 line 2 line 3 line 4 4 echo line 4 4 echo line 4 5 fc -l -1 -1expected-stderr-pattern: /^X*$/---name: history-list-6description: HISTSIZE limits about of history kept. (ksh88 fails 'cause it lists the fc command)arguments: !-i!env-setup: !ENV=./Env!HISTFILE=hist.file!HISTSIZE=3!file-setup: file 644 "Env" PS1=Xstdin: echo line 1 echo line 2 echo line 3 echo line 4 echo line 5 fc -lexpected-stdout: line 1 line 2 line 3 line 4 line 5 4 echo line 4 5 echo line 5expected-stderr-pattern: /^X*$/---name: history-list-7description: fc allows too old/new errors in range specificationarguments: !-i!env-setup: !ENV=./Env!HISTFILE=hist.file!HISTSIZE=3!file-setup: file 644 "Env" PS1=Xstdin: echo line 1 echo line 2 echo line 3 echo line 4 echo line 5 fc -l 1 30expected-stdout: line 1 line 2 line 3 line 4 line 5 4 echo line 4 5 echo line 5 6 fc -l 1 30expected-stderr-pattern: /^X*$/---name: history-list-r-1description: test -r flag in historyarguments: !-i!env-setup: !ENV=./Env!HISTFILE=hist.file!file-setup: file 644 "Env" PS1=Xstdin: echo line 1 echo line 2 echo line 3 echo line 4 echo line 5 fc -l -r 2 4expected-stdout: line 1 line 2 line 3 line 4 line 5 4 echo line 4 3 echo line 3 2 echo line 2expected-stderr-pattern: /^X*$/---name: history-list-r-2description: If first is newer than last, -r is implied.arguments: !-i!env-setup: !ENV=./Env!HISTFILE=hist.file!file-setup: file 644 "Env" PS1=Xstdin: echo line 1 echo line 2 echo line 3 echo line 4 echo line 5 fc -l 4 2expected-stdout: line 1 line 2 line 3 line 4 line 5 4 echo line 4 3 echo line 3 2 echo line 2expected-stderr-pattern: /^X*$/---name: history-list-r-3description: If first is newer than last, -r is cancelled.arguments: !-i!env-setup: !ENV=./Env!HISTFILE=hist.file!file-setup: file 644 "Env" PS1=Xstdin: echo line 1 echo line 2 echo line 3 echo line 4 echo line 5 fc -l -r 4 2expected-stdout: line 1 line 2 line 3 line 4 line 5 2 echo line 2 3 echo line 3 4 echo line 4expected-stderr-pattern: /^X*$/---name: history-subst-1description: Basic substitutionarguments: !-i!env-setup: !ENV=./Env!HISTFILE=hist.file!file-setup: file 644 "Env" PS1=Xstdin: echo abc def echo ghi jkl fc -e - abc=AB 'echo a'expected-stdout: abc def ghi jkl AB defexpected-stderr-pattern: /^X*echo AB def\nX*$/---name: history-subst-2description: Does subst find previous command?arguments: !-i!env-setup: !ENV=./Env!HISTFILE=hist.file!file-setup: file 644 "Env" PS1=Xstdin: echo abc def echo ghi jkl fc -e - jkl=XYZQRT 'echo g'expected-stdout: abc def ghi jkl ghi XYZQRTexpected-stderr-pattern: /^X*echo ghi XYZQRT\nX*$/---name: history-subst-3description: Does subst find previous command when no arguments givenarguments: !-i!env-setup: !ENV=./Env!HISTFILE=hist.file!file-setup: file 644 "Env" PS1=Xstdin: echo abc def echo ghi jkl fc -e - jkl=XYZQRTexpected-stdout: abc def ghi jkl ghi XYZQRTexpected-stderr-pattern: /^X*echo ghi XYZQRT\nX*$/---name: history-subst-4description: Global substitutions work (ksh88 and ksh93 do not have -g option)arguments: !-i!env-setup: !ENV=./Env!HISTFILE=hist.file!file-setup: file 644 "Env" PS1=Xstdin: echo abc def asjj sadjhasdjh asdjhasd fc -e - -g a=FooBARexpected-stdout: abc def asjj sadjhasdjh asdjhasd FooBARbc def FooBARsjj sFooBARdjhFooBARsdjh FooBARsdjhFooBARsdexpected-stderr-pattern: /^X*echo FooBARbc def FooBARsjj sFooBARdjhFooBARsdjh FooBARsdjhFooBARsd\nX*$/---name: history-subst-5description: Make sure searches don't find current (fc) command (ksh88/ksh93 don't have the ? prefix thing so they fail this test)arguments: !-i!env-setup: !ENV=./Env!HISTFILE=hist.file!file-setup: file 644 "Env" PS1=Xstdin: echo abc def echo ghi jkl fc -e - abc=AB \?abcexpected-stdout: abc def ghi jkl AB defexpected-stderr-pattern: /^X*echo AB def\nX*$/---name: history-ed-1description: Basic (ed) editing works (assumes you have generic ed editor that prints no prompts).# No ed on os/2 (yet?).category: !os:os2arguments: !-i!env-setup: !ENV=./Env!HISTFILE=hist.file!file-setup: file 644 "Env" PS1=Xstdin: echo abc def fc echo s/abc/FOOBAR/ w qexpected-stdout: abc def 13 16 FOOBAR defexpected-stderr-pattern: /^X*echo FOOBAR def\nX*$/---name: history-ed-2description: Correct command is edited when number givencategory: !os:os2arguments: !-i!env-setup: !ENV=./Env!HISTFILE=hist.file!file-setup: file 644 "Env" PS1=Xstdin: echo line 1 echo line 2 is here echo line 3 echo line 4 fc 2 s/is here/is changed/ w qexpected-stdout: line 1 line 2 is here line 3 line 4 20 23 line 2 is changedexpected-stderr-pattern: /^X*echo line 2 is changed\nX*$/---name: history-ed-3description: Newly created multi line commands show up as single command in history. (NOTE: will fail if using COMPLEX HISTORY compile time option) (ksh88 fails 'cause it lists the fc command)category: !os:os2arguments: !-i!env-setup: !ENV=./Env!HISTFILE=hist.file!file-setup: file 644 "Env" PS1=Xstdin: echo abc def fc echo s/abc/FOOBAR/ $a echo a new line . w q fc -lexpected-stdout: abc def 13 32 FOOBAR def a new line 1 echo abc def 2 echo FOOBAR def echo a new lineexpected-stderr-pattern: /^X*echo FOOBAR def\necho a new line\nX*$/---
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -