欧美成人午夜免费全部完,亚洲午夜福利精品久久,а√最新版在线天堂,另类亚洲综合区图片小说区,亚洲欧美日韩精品色xxx

扣丁學(xué)堂Linux培訓(xùn)分享所有Bash Shell內(nèi)置命令的方法示例

2019-09-06 10:05:52 4502瀏覽

大家都知道不同的Shell內(nèi)置命令有所不同,所以本篇文章扣丁學(xué)堂Linux培訓(xùn)小編就給大家簡單介紹一下關(guān)于如何列出所有Bash Shell內(nèi)置命令的相關(guān)資料,感興趣的小伙伴就隨小編來一起學(xué)習(xí)學(xué)習(xí)吧。


扣丁學(xué)堂Linux培訓(xùn)分享所有Bash Shell內(nèi)置命令的方法示例



Shell有很多內(nèi)置在其源代碼中的命令。這些命令是內(nèi)置的,所以Shell不必到磁盤上搜索它們,執(zhí)行速度因此加快,不同的Shell內(nèi)置命令有所不同。內(nèi)置命令包含在bash shell本身里面。我們?cè)撊绾卧贚inux / Apple OS X / *BSD / Unix類操作系統(tǒng)列出所有的內(nèi)置bash命令,而不用去讀大篇的bash操作說明頁?


shell內(nèi)置命令就是一個(gè)命令或一個(gè)函數(shù),從shell中調(diào)用,它直接在shell中執(zhí)行。bash shell直接執(zhí)行該命令而無需調(diào)用其他程序。你可以使用help命令查看Bash內(nèi)置命令的信息。以下是幾種不同類型的內(nèi)置命令。



內(nèi)置命令的類型


Bourne Shell內(nèi)置命令:內(nèi)置命令繼承自Bourne Shell。

Bash內(nèi)置命令:特定于Bash的內(nèi)置命令表。

修改Shell行為:修改shell屬性和可選行為的內(nèi)置命令。

特別的內(nèi)置命令:由POSIX特別分類的內(nèi)置命令。



如何查看所有bash內(nèi)置命令


有以下的命令:


$ help
$ help | less
$ help | grep read 


樣例輸出:


GNU bash, version 4.1.5(1)-release (x86_64-pc-linux-gnu)
These shell commands are defined internally. Type `help' to see this list.
Type `help name' to find out more about the function `name'.
Use `info bash' to find out more about the shell in general.
Use `man -k' or `info' to find out more about commands not in this list.
 
A star (*) next to a name means that the command is disabled.
 
 job_spec [&]              history [-c] [-d offset] [n] or hist>
 (( expression ))            if COMMANDS; then COMMANDS; [ elif C>
 . filename [arguments]         jobs [-lnprs] [jobspec ...] or jobs >
 :                    kill [-s sigspec | -n signum | -sigs>
 [ arg... ]               let arg [arg ...]
 [[ expression ]]            local [option] name[=value] ...
 alias [-p] [name[=value] ... ]     logout [n]
 bg [job_spec ...]            mapfile [-n count] [-O origin] [-s c>
 bind [-lpvsPVS] [-m keymap] [-f filen> popd [-n] [+N | -N]
 break [n]                printf [-v var] format [arguments]
 builtin [shell-builtin [arg ...]]    pushd [-n] [+N | -N | dir]
 caller [expr]              pwd [-LP]
 case WORD in [PATTERN [| PATTERN]...)> read [-ers] [-a array] [-d delim] [->
 cd [-L|-P] [dir]            readarray [-n count] [-O origin] [-s>
 command [-pVv] command [arg ...]    readonly [-af] [name[=value] ...] or>
 compgen [-abcdefgjksuv] [-o option] > return [n]
 complete [-abcdefgjksuv] [-pr] [-DE] > select NAME [in WORDS ... ;] do COMM>
 compopt [-o|+o option] [-DE] [name ..> set [--abefhkmnptuvxBCHP] [-o option>
 continue [n]              shift [n]
 coproc [NAME] command [redirections]  shopt [-pqsu] [-o] [optname ...]
 declare [-aAfFilrtux] [-p] [name[=val> source filename [arguments]
 dirs [-clpv] [+N] [-N]         suspend [-f]
 disown [-h] [-ar] [jobspec ...]     test [expr]
 echo [-neE] [arg ...]          time [-p] pipeline
 enable [-a] [-dnps] [-f filename] [na> times
 eval [arg ...]             trap [-lp] [[arg] signal_spec ...]
 exec [-cl] [-a name] [command [argume> true
 exit [n]                type [-afptP] name [name ...]
 export [-fn] [name[=value] ...] or ex> typeset [-aAfFilrtux] [-p] name[=val>
 false                  ulimit [-SHacdefilmnpqrstuvx] [limit>
 fc [-e ename] [-lnr] [first] [last] o> umask [-p] [-S] [mode]
 fg [job_spec]              unalias [-a] name [name ...]
 for NAME [in WORDS ... ] ; do COMMAND> unset [-f] [-v] [name ...]
 for (( exp1; exp2; exp3 )); do COMMAN> until COMMANDS; do COMMANDS; done
 function name { COMMANDS ; } or name > variables - Names and meanings of so>
 getopts optstring name [arg]      wait [id]
 hash [-lr] [-p pathname] [-dt] [name > while COMMANDS; do COMMANDS; done
 help [-dms] [pattern ...]        { COMMANDS ; }


另外一種選擇是使用下列命令:


compgen -b
compgen -b | more


查看 Bash 的內(nèi)置命令信息


運(yùn)行以下得到詳細(xì)信息:


help command
help read


要僅得到所有帶簡短描述的內(nèi)置命令的列表,執(zhí)行如下:


$ help -d


查找內(nèi)置命令的語法和其他選項(xiàng)

使用下列語法去找出更多的相關(guān)內(nèi)置命令:


help name 
help cd 
help fg 
help for 
help read 
help :


樣例輸出:


:: :
 Null command.
 
 No effect; the command does nothing.
 
 Exit Status:
 Always succeeds



找出一個(gè)命令是內(nèi)部的(內(nèi)置)還是外部的


使用 type 命令或 command 命令:


type -a command-name-here 
type -a cd 
type -a uname 
type -a : 
type -a ls


或者:

type -a cd uname : ls uname


樣例輸出:

cd is a shell builtin
uname is /bin/uname
: is a shell builtin
ls is aliased to `ls --color=auto'
ls is /bin/ls
l is a function
l ()
{
 ls --color=auto
}


或者:

command -V ls 
command -V cd 
command -V foo

想要了解更多關(guān)于Linux開發(fā)方面內(nèi)容的小伙伴,請(qǐng)關(guān)注扣丁學(xué)堂Linux培訓(xùn)官網(wǎng)、微信等平臺(tái),扣丁學(xué)堂IT職業(yè)在線學(xué)習(xí)教育有專業(yè)的Linux講師為您指導(dǎo),此外扣丁學(xué)堂老師精心推出的Linux視頻教程定能讓你快速掌握Linux從入門到精通開發(fā)實(shí)戰(zhàn)技能??鄱W(xué)堂Linux技術(shù)交流群:422345477。


                          JavaEE/微服務(wù)/源碼解析/分布式/企業(yè)級(jí)架構(gòu)【VIP體驗(yàn)課】


     【關(guān)注微信公眾號(hào)獲取更多學(xué)習(xí)資料】        【掃碼進(jìn)入JavaEE/微服務(wù)VIP免費(fèi)公開課】  



查看更多關(guān)于“Linux培訓(xùn)資訊”的相關(guān)文章>>

標(biāo)簽: Linux培訓(xùn) Linux視頻教程 紅帽Linux視頻 Linux學(xué)習(xí)視頻 Linux入門視頻 紅帽RHCE/RHCSA考試

熱門專區(qū)

暫無熱門資訊

課程推薦

微信
微博
15311698296

全國免費(fèi)咨詢熱線

郵箱:codingke@1000phone.com

官方群:148715490

北京千鋒互聯(lián)科技有限公司版權(quán)所有   北京市海淀區(qū)寶盛北里西區(qū)28號(hào)中關(guān)村智誠科創(chuàng)大廈4層
京ICP備2021002079號(hào)-2   Copyright ? 2017 - 2022
返回頂部 返回頂部