bash 기록에 문제가 있습니다.greping 히스토리가 올바르게 작동하지 않으면! bang으로 내역 명령 실행
내가 역사를 history | grep forever
으로 부르는 것을 가정 해 봅시다. 영원히 포함 된 모든 이전 명령은 해당 숫자와 함께 표시됩니다.
이러한 명령 중 하나를 해당 번호 (예 : !2121
)로 실행하면 내역과 다른 명령이 호출되고 해당 번호와 연결된 명령이 호출되지 않습니다. 내가 뭘 잘못하고 있니?
greping하지 않고 기록을 호출하면 예상대로 뱅 실행이 작동합니다.
들으
무서운 예 :
...
1742 forever stop 0
1743 forever -o out.log -e err.log start -c nodemon hotnews.js
1784 forever list
1814 forever list
2496 forever -o out.log -e err.log start -c nodemon hotnews.js
2498 forever -o out.log -e err.log start -c nodemon hotnews.js
2957 forever -o out.log -e err.log start -c nodemon hotnews.js
3292 forever -o out.log -e err.log start -c nodemon hotnews.js
3452 forever -o out.log -e err.log start -c nodemon hotnews.js
3603 forever -o out.log -e err.log start -c nodemon hotnews.js
3614 history | grep forever
[~]$ !1784
npm uninstall express-flash
npm WARN uninstall not installed in /home/development/node_modules: "express-flash"
[~]$
편집 :
내가 .bashrc에 내 역사의 속성을 변경 기억 :
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
export HISTCONTROL=ignoreboth:erasedups
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
export HISTSIZE=100000
export HISTFILESIZE=100000
# ignoriert einfache Befehle wie cd
export HISTIGNORE='cd:ls:bg:fg:history'
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
아마 어떻게 든 결함이 항목입니다 ?
숫자가 '.bash_history' 파일의 명령에 해당합니까? – styvane
예, 위의 예를보세요. – Subimago
죄송합니다. 니가 옳았 어. history-command의 결과는 .bash_history (cat -n .bash_history)와 다른 숫자입니다. 어떻게 이럴 수있어? – Subimago