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

扣丁學堂Linux培訓簡述shell中常見參數(shù)及判斷命令

2019-04-02 15:34:19 2959瀏覽

今天小編給讀者們分享一下shell中常見參數(shù)及判斷命令,對Linux開發(fā)技術感興趣或者是想要參加Linux培訓進入Linux開發(fā)領域中的小伙伴可以隨小編來看一下,文中有詳細的代碼列出,具有很好的參考價值,希望對讀者們有所幫助。



扣丁學堂Linux培訓簡述shell中常見參數(shù)及判斷命令



Shell常用特殊變量:


經(jīng)常會在shell命令中,看到$0, $#, $*, $@, $?, $$這樣的取值,這些代表什么呢?


Linux視頻教程


$* 和 $@ 都是將參數(shù)一個一個返回

"$*"將所有參數(shù)當做一個整體字符串返回 , "$@"將參數(shù)一個一個返回



常用判斷參數(shù)


在shell命令文件中還經(jīng)常會看到類似與if [ -z "${SPARK_HOME}" ]; then這樣的判斷語句?是不是也和我一樣很疑惑-z是什么含義?


下面是幾個常見的參數(shù),供查詢使用:


-a file exists. 
-b file exists and is a block special file. 
-c file exists and is a character special file. 
-d file exists and is a directory. 
-e file exists (just the same as -a). 
-f file exists and is a regular file. 
-g file exists and has its setgid(2) bit set. 
-G file exists and has the same group ID as this process. 
-k file exists and has its sticky bit set. 
-L file exists and is a symbolic link. 
-n string length is not zero. 
-o Named option is set on. 
-O file exists and is owned by the user ID of this process. 
-p file exists and is a first in, first out (FIFO) special file or named pipe. 
-r file exists and is readable by the current process. 
-s file exists and has a size greater than zero. 
-S file exists and is a socket. 
-t file descriptor number fildes is open and associated with a terminal device. 
-u file exists and has its setuid(2) bit set. 
-w file exists and is writable by the current process. 
-x file exists and is executable by the current process. 
-z string length is zero. 



斷命令


shell中除了有上邊這樣用來判斷文件是否存在的參數(shù),當然還有判斷兩個數(shù)是否相等這樣更常規(guī)的命令。


例如,if [ $# -gt 0 ]這樣判斷傳入?yún)?shù)個數(shù)是否為0


Linux學習


以上就是扣丁學堂Linux在線學習小編給大家分享的shell中常見參數(shù)及判斷命令,希望對小伙伴們有所幫助,想要了解更多內容的小伙伴可以登錄扣丁學堂官網(wǎng)咨詢。


想要學好Linux開發(fā)小編給大家推薦口碑良好的扣丁學堂,扣丁學堂有專業(yè)老師制定的Linux學習路線圖輔助學員學習,此外還有與時俱進的Linux課程體系和Linux視頻教程供大家學習,想要學好Linux開發(fā)技術的小伙伴快快行動吧。扣丁學堂Linux技術交流群:422345477。


                          


 【關注微信公眾號獲取更多學習資料】         【掃碼進入HTML5進階免費公開課】



查看更多關于“Linux培訓資訊”的相關文章>>

標簽: linux系統(tǒng)入門學習 linux培訓 linux視頻教程 linux基礎教程 linux在線視頻 linux在線學習 linux從入門到精通 linux開發(fā)環(huán)境包 linux系統(tǒng) linux開發(fā)教程

熱門專區(qū)

暫無熱門資訊

課程推薦

微信
微博
15311698296

全國免費咨詢熱線

郵箱:codingke@1000phone.com

官方群:148715490

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