help命令可以查看協助help test 正確做法: #!/bin/sh STRING= if [ -z "$STRING" ]; then echo "STRING is empty" fi if [ -n "$STRING" ]; then echo "STRING is not empty" fi root@james-desktop:~# ./zerostring.sh STRING is empty----------------------
exec也是讓script在同一個進程上執行,但是原有進程則被結束了 指令碼內容:root@james-desktop:/opt/qt-everywhere/marvell/APP/applications/factory-roast# cat 1.sh #!/bin/sh A=B echo "PID for 1.sh :$$" export A echo "1.sh \$A is $A" case $1 in exec)
Bash Shell 快速鍵的學習使用作者: Fenng | 可以轉載, 轉載時務必以超連結形式標明文章原始出處和作者資訊及著作權聲明網址: http://www.dbanotes.net/techmemo/shell_shortcut.html 這篇 Bash Shell Shortcuts 的快速鍵總結的非常好。值得學習。下面內容大多數是拷貝粘貼與總結.">CTRL 鍵相關的快速鍵:Ctrl + a - Jump to the start of the lineCtrl + b -
在看 學習shell中練習的代碼#!/bin/bash# User can keyin filename to touch 3 new files.PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/gamesexport PATHecho "I will use 'touch' command to create 3 files."read -p "Please input the filename
Unix-like systems such as linux always have a single file system tree, regardless of how many drives or storage devices are attached to the computer.Storage devices are attached( mounted ) at various points on the tree according to the system
-rw-r--r-- Access rights to the file.The first character indicated the type of file. a leading dash means a regular file, while a 'd' indicates a directory. the next three characters
預設情況下,Ubuntu終端會輸出完整路徑,在路徑名很長的時候,提示方式很不友好,通過以下步驟修改PS1變數的設定,可以讓終端輸出相對路徑。類似於紅帽系統的風格。修改思路:將w修改為W顯示絕對路徑,並添加[]括弧。首先修改/etc/bash.bashrc檔案leo@leo-laptop:~$ sudo vim /etc/bash.bashrc修改如下內容:#PS1=’${debian_chroot:+($debian_chroot)}u@h:w$ ‘PS1=’[${debian_chroot:+