
{"id":17201,"date":"2018-09-26T17:25:52","date_gmt":"2018-09-26T17:25:52","guid":{"rendered":"http:\/\/www.beautifulwork.org\/?p=17201"},"modified":"2018-09-26T17:25:52","modified_gmt":"2018-09-26T17:25:52","slug":"finding-source-code-or-source-file-of-a-typical-bash-function","status":"publish","type":"post","link":"https:\/\/www.trueangle.org\/index.php\/2018\/09\/26\/finding-source-code-or-source-file-of-a-typical-bash-function\/","title":{"rendered":"finding source code or source file of a typical bash function"},"content":{"rendered":"\n<pre class=\"wp-block-preformatted\">$type -a signals\nbash: type: signals: not found\n$type -a _signals\n_signals is a function\n_signals () \n{ \n    local -a sigs=($( compgen -P \"$1\" -A signal \"SIG${cur#$1}\" ));\n    COMPREPLY+=(\"${sigs[@]\/#${1}SIG\/${1}}\")\n}\n$declare -F _signals \n_signals\n$shopt -s extdebug\n$declare -F _signals \n_signals 862 \/usr\/share\/bash-completion\/bash_completion\n$declare -F _command\n_command 1732 \/usr\/share\/bash-completion\/bash_completion\n$declare -F compgen\n$declare -F _grub_dirs\n$declare -F _grub_dir\n$shopt -s extdebug\n$declare -F _grub_dir\n$declare -F _grub_dirs\n$declare -F __grub_dir\n__grub_dir 20 \/etc\/bash_completion.d\/grub\n$<br \/><br \/>$type __grub_dir\n__grub_dir is a function\n__grub_dir () \n{ \n    local i c=1 boot_dir;\n    for ((c=1; c &lt;= ${#COMP_WORDS[@]}; c++ ))\n    do\n        i=\"${COMP_WORDS[c]}\";\n        case \"$i\" in \n            --boot-directory)\n                c=$((++c));\n                i=\"${COMP_WORDS[c]}\";\n                boot_dir=\"${i##*=}\";\n                break\n            ;;\n        esac;\n    done;\n    boot_dir=${boot_dir-\/boot};\n    echo \"${boot_dir%\/}\/grub\"\n}\n$__grub_dir\n\/boot\/grub\n$__grub_dir --help\n\/boot\/grub\n$ech0 $?\nbash: ech0: command not found\n$echo $?\n127\n$__grub_dir --help\n\/boot\/grub\n$echo $?\n0\n$<br \/><div><br \/><br \/>$_command\nbash: COMP_WORDS: bad array subscript\nbash: compopt: not currently executing completion function\nbash: compopt: not currently executing completion function\nbash: compopt: not currently executing completion function\nbash: compopt: not currently executing completion function\nbash: compopt: not currently executing completion function\nbash: compopt: not currently executing completion function\nbash: compopt: not currently executing completion function\nbash: compopt: not currently executing completion function\nbash: compopt: not currently executing completion function\nbash: compopt: not currently executing completion function\nbash: compopt: not currently executing completion function\nbash: compopt: not currently executing completion function\nbash: compopt: not currently executing completion function\nbash: compopt: not currently executing completion function\nbash: compopt: not currently executing completion function\nbash: compopt: not currently executing completion function\nbash: compopt: not currently executing completion function\nbash: compopt: not currently executing completion function\nbash: compopt: not currently executing completion function\nbash: compopt: not currently executing completion function\nbash: compopt: not currently executing completion function\nbash: compopt: not currently executing completion function\nbash: compopt: not currently executing completion function\nbash: compopt: not currently executing completion function\n$type _command\n_command is a function\n_command () \n{ \n    local offset i;\n    offset=1;\n    for ((i=1; i &lt;= COMP_CWORD; i++ ))\n    do\n        if [[ \"${COMP_WORDS[i]}\" != -* ]]; then\n            offset=$i;\n            break;\n        fi;\n    done;\n    _command_offset $offset\n}\n$type -a _command\n_command is a function\n_command () \n{ \n    local offset i;\n    offset=1;\n    for ((i=1; i &lt;= COMP_CWORD; i++ ))\n    do\n        if [[ \"${COMP_WORDS[i]}\" != -* ]]; then\n            offset=$i;\n            break;\n        fi;\n    done;\n    _command_offset $offset\n}\n$<br \/><\/div><div><br \/><\/div><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>$type -a signals bash: type: signals: not found $type -a _signals _signals is a function _signals () { local -a sigs=($( compgen -P &#8220;$1&#8221; -A signal &#8220;SIG${cur#$1}&#8221; )); COMPREPLY+=(&#8220;${sigs[@]\/#${1}SIG\/${1}}&#8221;) } $declare -F _signals _signals $shopt -s extdebug $declare -F _signals _signals 862 \/usr\/share\/bash-completion\/bash_completion $declare -F _command _command 1732 \/usr\/share\/bash-completion\/bash_completion $declare -F compgen $declare -F _grub_dirs &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.trueangle.org\/index.php\/2018\/09\/26\/finding-source-code-or-source-file-of-a-typical-bash-function\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;finding source code or source file of a typical bash function&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[803,1437],"_links":{"self":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/17201"}],"collection":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/comments?post=17201"}],"version-history":[{"count":0,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/17201\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/media?parent=17201"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/categories?post=17201"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/tags?post=17201"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}