fc: a semi-special built-in
1
2
3
1	echo 1
2	echo 2
3	echo 3
4	fc -l
0
6
7
8
9
10
11
12
13
14
15
16
17
18
19
5	echo $?
6	echo 6
7	echo 7
8	echo 8
9	echo 9
10	echo 10
11	echo 11
12	echo 12
13	echo 13
14	echo 14
15	echo 15
16	echo 16
17	echo 17
18	echo 18
19	echo 19
20	fc -l
21	fc -l -1
10	echo 10
11	echo 11
12	echo 12
13	echo 13
23	fc -l 23 21
22	fc -l 10 13
21	fc -l -1
13	echo 13
12	echo 12
11	echo 11
10	echo 10
21	fc -l -1
22	fc -l 10 13
23	fc -l 23 21
	echo 19
	fc -l
27
28
29
echo 29
29
echo 27
27
27
fc -l -n 'echo 1' 20
	echo 19
	fc -l
fc -l -n 'echo 18' 20
	echo 18
	echo 19
	fc -l
35
36
37
38
39
echo 39
39
echo 39
39
fc: the editor returned a non-zero exit status
echo 36
echo 37
echo 38
echo ok
36
37
38
ok
echo 38
echo 37
echo 36
echo ok
38
37
36
ok
36
37
38
ok
54	echo ok
55	fc -l -2
=====
inner shell
53	echo 38
54	echo ok
55	fc -l -2
56	echo =====
57	$INVOKE $TESTEE -i +m --rcfile="$RC" <<\EOF2
58	echo inner shell; fc -l 53
59	EOF2
60	echo inner shell; fc -l 53
=====
===== 1 =====
31
32
33
19	echo 36
20	echo 37
21	echo 38
22	echo ok
23	fc -l -2
24	echo =====
25	$INVOKE $TESTEE -i +m --rcfile="$RC" <<\EOF2
26	echo inner shell; fc -l 53
27	EOF2
28	echo inner shell; fc -l 53
29	echo =====
30	exit
31	echo 31
32	echo 32
33	echo 33
34	fc -l
===== 2 =====
31
28	echo 32
29	echo 33
30	fc -l
31	echo 31
32	history 5
28	echo 32
29	echo 33
30	fc -l
31	echo 31
32	history 5
1
2
3
echo 1
echo 2
echo 3
history -w -
a
b
c
echo 1
echo 2
echo 3
history -w -
history -w "${TESTTMP}"/history2 -c
1	echo a
2	echo b
3	echo c
4	cat "${TESTTMP}"/history2
5	history -r "${TESTTMP}"/history2 -r - <<\END
6	echo x
7	END
8	echo 1
9	echo 2
10	echo 3
11	history -w -
12	history -w "${TESTTMP}"/history2 -c
13	echo x
14	1
15	2
16	3
17	history
===== 3 =====
1
2
3
4
5
6
7
1	echo 1
3	echo 3
4	echo 4
5	echo 5
7	echo 7
8	history -d 2 -d 6; fc -l
3	echo 3
4	echo 4
5	echo 5
5	echo 5
4	echo 4
3	echo 3
5	echo 5
4	echo 4
3	echo 3
3	echo 3
4	echo 4
5	echo 5
echo 3
echo 4
echo 5
3
4
5
echo 5
echo 4
echo 3
5
4
3
echo 5
echo 4
echo 3
5
4
3
echo 3
echo 4
echo 5
3
4
5
1	echo 1
3	echo 3
3	echo 3
1	echo 1
3	echo 3
1	echo 1
1	echo 1
3	echo 3
===== 4 =====
===== 5 =====
1
1
1
2
1
2
1
2
3
1
2
3
1
2
3
4
1
2
3
4
1
2
3
4
5
4
3
2
1
	echo 1
	echo 2
	echo 3
	echo 4
	echo 1
	echo 2
	echo 3
	echo 4
	echo 1
	echo 2
	echo 5
	echo 4
	echo 3
	echo 2
	echo 1
	fc -ln
===== 6 =====
32753	: 15
32754	: 14
32755	: 13
32756	: 12
32757	: 11
32758	: 10
32759	: 9
32760	: 8
32761	: 7
32762	: 6
32763	: 5
32764	: 4
32765	: 3
32766	: 2
32767	: 1
32768	fc -l
32740	: 28
32741	: 27
32742	: 26
32743	: 25
32744	: 24
32745	: 23
32746	: 22
32747	: 21
32748	: 20
32749	: 19
32750	: 18
32751	: 17
32752	: 16
32753	: 15
32754	: 14
32755	: 13
===== histspace =====
a
b
c
d
e
f
g
1	echo a
2	 echo b
3	 set --histspace
4	echo c
5	echo f
6	 echo g
7	  fc -l
===== error =====
fc no-such-option 2
fc invalid-option-combination l e 2
fc invalid-option-combination s e 2
fc invalid-option-combination l q 2
fc invalid-option-combination l s 2
fc invalid-option-combination r s 2
fc invalid-option-combination n 2
fc invalid-option-combination v 2
fc history-empty 2 1
fc history-empty 3 1
fc history-empty 5 1
fc history-empty 6 1
fc no-such-entry 1 1
fc no-such-entry 2 1
fc no-such-entry 3 1
fc too-many-operands 1 2
fc too-many-operands 2 2
fc too-many-operands 3 2
history no-such-option 2
history too-many-operands 2
history output error 1
history no-such-entry 1
history no-such-file 1 1
history no-such-file 2 1
