六月丁香五月婷婷,丁香五月婷婷网,欧美激情网站,日本护士xxxx,禁止18岁天天操夜夜操,18岁禁止1000免费,国产福利无码一区色费

學(xué)習(xí)啦 > 學(xué)習(xí)電腦 > 操作系統(tǒng) > Linux教程 > linux true命令詳解

linux true命令詳解

時(shí)間: 佳洲1085 分享

linux true命令詳解

  true命令是linux下的一個(gè)命令。那么它有什么用處呢?下面由學(xué)習(xí)啦小編為大家整理了linux true命令的相關(guān)知識(shí),希望對(duì)大家有幫助!

  linux true命令用途說(shuō)明

  true命令啥都不做,只設(shè)置退出碼為0。在Linux底下,每個(gè)程序執(zhí)行完畢都會(huì)返回一個(gè)退出碼給調(diào)用者,一般情況下0表示成功,其他值表明有問(wèn)題,當(dāng)然某些程序的退出碼有特殊含義。有些shell下true可能是個(gè)內(nèi)建命令,至少bash下是。(do nothing, successfully。Exit with a status code indicating success. NOTE: your shell may have its own version of true, which usually supersedes the version described here. Please refer to your shell’s documentation for details about the options it supports.)相對(duì)應(yīng)的命令是false,也是啥都不干,但退出碼設(shè)置為1。

  linux true命令常用參數(shù)

  顯示退出碼的方式:echo $?

  死循環(huán)的寫法:while true; do commands; done

  另外一個(gè)內(nèi)建命令:,就是一個(gè)冒號(hào),也可達(dá)到true一樣的效果。

  死循環(huán)的寫法二:while : ;do commands; done

  linux true命令使用示例

  示例一 Bash下true是個(gè)內(nèi)建命令

  [root@new55 ~]# type -a true

  true is a shell builtin

  true is /bin/true

  [root@new55 ~]#

  示例二

  [root@web186 root]# true; echo $?

  0

  空指令:也可達(dá)到true命令一樣的效果。

  [root@web186 root]# false; echo $?; :; echo $?

  1

  0

  [root@web186 root]#

3583974