이상한 setopt 동작

이상한 setopt 동작

일부 옵션의 경우 setopt가 효과가 없습니다.

➜  ~  setopt | grep history
extendedhistory
➜  ~  setopt appendhistory
➜  ~  setopt | grep history # appendhistory apparently didn't get set
extendedhistory
➜  ~  setopt sharehistory
➜  ~  setopt | grep history # but sharehistory does
extendedhistory
sharehistory

왜?

답변1

setopt현재 시뮬레이션 모드와의 편차를 출력합니다. 시뮬레이션 appendhistory의 기본 설정입니다 zsh.

모든 옵션의 상태를 표시하려면 를 사용할 수 있습니다 set -o.

인용 문서:

 If no arguments are supplied, the names of all options currently
 set are printed.  The form is chosen so as to minimize the
 differences from the default options for the current emulation (the
 default emulation being native zsh, shown as <Z> in *note
 Description of Options::).  Options that are on by default for the
 emulation are shown with the prefix no only if they are off, while
 other options are shown without the prefix no and only if they are
 on.  In addition to options changed from the default state by the
 user, any options activated automatically by the shell (for
 example, SHIN_STDIN or INTERACTIVE) will be shown in the list.  The
 format is further modified by the option KSH_OPTION_PRINT, however
 the rationale for choosing options with or without the no prefix
 remains the same in this case.

관련 정보