이전과 마찬가지로 $PWD 대신 macOS의 $HOME에서 새(로그인) 셸(windows)이 열립니다. 무엇을 제공합니까?

이전과 마찬가지로 $PWD 대신 macOS의 $HOME에서 새(로그인) 셸(windows)이 열립니다. 무엇을 제공합니까?

새 셸 창을 열 때마다 새 Terminal.app 창을 열라는 명령을 실행할 때 현재 있는 디렉터리가 아닌 홈 디렉터리로 이동하게 됩니다. 도움이 될 경우를 대비해 각각의 새로운 셸 인스턴스는 macOS의 로그인 셸이라는 인상을 받았습니다. 최근에 .bashrc를 일부 변경했지만, 제가 아는 한에는 영향을 미치지 않습니다. 또한 .inputrc(readline rc 파일)도 추가했습니다. 내가 추가한 모든 새로운 구성은 신뢰할 수 있는 온라인 소스에서 찾았습니다. 어쨌든, .bashrc에 추가한 새로운 구성은 다음과 같습니다.

## BETTER BASH HISTORY
# tells readline to perform filename completion case-insensitively
#bind "set completion-ignore-case on"
# filename matching during completion will treat hyphens and underscores as equivalent; 
#+ requires completion-ignore-case on
#bind "set completion-map-case on"
# readline will display all possible matches for an ambiguous pattern at first 
#+ <tab> instead of 2x
#bind "set show-all-if-ambiguous on"
# Append to the history file, don't overwrite it
shopt -s histappend
# Save multi-line commands as one command
shopt -s cmdhist
# Record each line as it gets issued (aka "parallel history"?)
PROMPT_COMMAND='history -a'
# Yuge history. Doesn't appear to slow things down, so why not?
HISTSIZE=500000
HISTFILESIZE=100000
# Avoid duplicate entries
HISTCONTROL="erasedups:ignoreboth"
# Don't record some commands
export HISTIGNORE="&:[  ]*:exit:ls:history:cd:pwd"
# Useful timestamp format
HISTTIMEFORMAT='%F %T '
#
## Better, faster directory navigation
# don't need to type cd, just path to cd; works for .., but not -
#shopt -s autocd    # invalid shell option name
# dirspell and cdspell get bash to autocorrect minor spelling mistakes:
# the former during tab completion, the latter in arguments already supplied to cd
#shopt -s dirspell   # invalid shell option name
shopt -s cdspell
#
# by default, cd will look in the curdir for possible targets you might want to move into.
# this behavior is defined by the environment variable CDPATH="." by default.
# add more paths to this variable by separating them with a colon.
#
# native "jump" to directory from anywhere: we can define and export variables
# containing paths to our most important directories and cd into them
shopt -s cdable_vars

또한 이것은 소스 코드에서 사용하고 있는 inputrc 파일입니다. https://github.com/mrzool/dotfiles/blob/master/readline/.inputrc

# set editing-mode vi
# set keymap vi
set bell-style none

$if mode=vi
    set keymap vi-command
    "gg": beginning-of-history
    "G": end-of-history
    set keymap vi-insert
    "jj": vi-movement-mode
    "\C-w": backward-kill-word
    "\C-p": history-search-backward
$endif

# Use the text that has already been typed as the prefix for searching through
# commands (i.e. more intelligent Up/Down behavior)
"\e[A": history-search-backward
"\e[B": history-search-forward

# Completion tweaks
set completion-ignore-case on
set completion-map-case on
set show-all-if-ambiguous on
set mark-symlinked-directories on
set match-hidden-files on
# set visible-stats on
set skip-completed-text on
set colored-stats on

# Allow UTF-8 input and output
set input-meta on
set output-meta on
set convert-meta off

# Bash-specific mappings and settings
$if Bash
  Space: magic-space
  \C-w: backward-kill-word
$endif

답변1

다음 줄을 제거/주석 처리하세요.

PROMPT_COMMAND='history -a'

HISTCONTROL="erasedups:ignoreboth"

export HISTIGNORE="&:[ ]*:exit:ls:history:cd:pwd"

위의 줄을 주석 처리하면 문제가 해결된 것 같습니다. 응용 프로그램이나 셸 cdhistory.

관련 정보