最新高清无码专区,无人区码一码二码w358cc,99在线精品国自产拍不卡,亚洲国产欧美在线成人APP,男人天堂a在线,亚洲熟妇色,伊人毛片,国产精品亚洲mnbav网站

Shell 調試 -電腦資料

電腦資料 時間:2019-01-01
【www.gz-dh.cn - 電腦資料】

    一、簡介

    本文全面系統地介紹了shell腳本調試技術,包括使用echo, tee, trap等命令輸出關鍵信息,跟蹤變量的值,在腳本中植入調試鉤子,使用“-n”選項進行shell腳本的語法檢查, 使用“-x”選項實現shell腳本逐條語句的跟蹤,巧妙地利用shell的內置變量增強“-x”選項的輸出信息等,

Shell 調試

    二、shell調試選項

    1)只讀取shell腳本,不實際執行,用于檢測shell腳本是否存在語法錯誤

    -n

    2)使shell解釋器從一個字符串中讀取并執行shell指令,用于臨時測試小段腳本

    -c "string"

    3)進入跟蹤方式,使shell在執行腳本的過程中把它實際執行的每一個命令行顯示出來,并且在行首顯示一個"+"號

    -x

    示例:

   

$ sh –x exp2.sh+ trap 'echo "before execute line:$LINENO, a=$a,b=$b,c=$c"' DEBUG++ echo 'before execute line:3, a=,b=,c='before execute line:3, a=,b=,c=+ a=1++ echo 'before execute line:4, a=1,b=,c='before execute line:4, a=1,b=,c=+ '[' 1 -eq 1 ']'++ echo 'before execute line:6, a=1,b=,c='before execute line:6, a=1,b=,c=+ b=2++ echo 'before execute line:10, a=1,b=2,c='before execute line:10, a=1,b=2,c=+ c=3++ echo 'before execute line:11, a=1,b=2,c=3'before execute line:11, a=1,b=2,c=3+ echo endend

    三、shell調試工具:bashdb

    http://bashdb.sourceforge.net/

最新文章