check-builtin-support-for-help-option.sh (617B)
1 #!/usr/bin/env bash 2 3 # 調べた感じだと全て bash-4.4 の時点で導入された様だ。 4 cmds=( 5 times pwd suspend 6 7 alias bind cd command compgen complete compopt dirs disown enable exec 8 export fc getopts hash help history jobs kill mapfile popd printf pushd 9 read readonly set shopt trap type ulimit umask unalias unset wait 10 11 . source fg bg builtin caller eval let 12 break continue exit logout return shift 13 printf 14 15 declare typeset local readonly 16 ) 17 18 for cmd in "${cmds[@]}"; do 19 help=$("$cmd" --help 2>&1) 20 [[ $help == "$cmd: "* ]] && continue 21 echo "==== $cmd ====" 22 head -5 <<< "$help" 23 done