POSIX mode 相關資訊
如果要看全部的 options 可以使用 set -o
範例:
#!/bin/sh
set -o
結果:
allexport off
braceexpand on
emacs on
braceexpand on
emacs on
errexit off
errtrace off
functrace off
hashall on
histexpand on
history on
ignoreeof off
interactive-comments on
keyword off
monitor on
noclobber off
noexec off
noglob off
nolog off
notify off
nounset off
onecmd off
physical off
pipefail off
posix off
privileged off
verbose off
vi off
xtrace off
想要單獨看 posix 則使用 grep 取出,如下範例
#!/bin/sh
set -o | grep posix
結果:
posix on
範例:
#!/bin/sh
set -o | grep posix
set +o posix
set -o | grep posix
結果:
posix on
posix off
如果要設定 posix 為 on 可以使用 set -o posix
範例:
#!/bin/sh
set -o | grep posix
set +o posix
set -o | grep posix
set -o posix
set -o | grep posix
結果:
posix on
posix off
posix on
沒有留言:
張貼留言