File: D1314.bashrc.sh

package info (click to toggle)
ble.sh 0.4.0~git20250321.d4c812b-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 12,516 kB
  • sloc: sh: 71,367; awk: 1,316; cpp: 750; ansic: 186; javascript: 43; makefile: 35
file content (49 lines) | stat: -rw-r--r-- 1,110 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash

HISTFILE=A.txt

# echo A:$(builtin history 1)
# shopt -s histappend
# history -a
# echo B:$(builtin history 1)
# history -r
# echo C:$(builtin history 1)

# echo A:$(builtin history 1)
# shopt -s histappend
# history -n
# echo B:$(builtin history 1)

# builtin history 1; echo $?
# builtin history -s echo hello
# builtin history 1; echo $?

#------------------------------------------------------------------------------
# history -r が与える影響

function history-read-another-file.bashrc {
  # これを実行すると B.txt, A.txt の両方が読み取られる。
  HISTFILE=A.txt
  history -r B.txt
}

function history-read-same-file.bashrc {
  # これを実行すると A.txt が2回読み込まれる。
  HISTFILE=A.txt
  history -r A.txt
}

function history-read-default-file.bashrc {
  # これを実行しても A.txt が2回読み込まれる。
  HISTFILE=A.txt
  history -r
}

#------------------------------------------------------------------------------
# history -c が与える影響

function history-clear.bashrc {
  HISTFILE=A.txt
  history -c
}
history-clear.bashrc