假設我們想注釋多行**在bash中,我們可以這麼寫:
:<<'
這裡寫注釋內容
'
比如,沒注釋前,我的腳步是這樣的:
#!/bin/bash
export path=~/gogoal_platform/ggopenapi:~/play-1.2.7:$path
echo
"構建後的路徑pwd:"`pwd`
whoami
cd /home/developer/gogoal_platform/ggopenapi/api/ggservice/
cur=$(pwd)
currday=`date +%y%m%d`
# 打包的檔名
filename="ggservice-dataservice"
backup=`find . -name "$-*" | xargs ls -t | head -n 3|xargs|sed "s/.\///g"|xargs|sed "s/ /\\\\\\|/g"`
echo
"保留最近三個備份包:" \"$backup\"
echo "刪除的備份包:"`ls | grep "
$-.*" | grep -v $backup`
#刪除ggservice的備份包
rm -rf `ls | grep "
$-.*" | grep -v $backup | xargs | sed "s/ / /g"`
#建立最新的備份包
gogalwebfile=$/$-$currday
if [ ! -f $gogalwebfile ]; then
echo "不存在":$gogalwebfile
cp -r $.jar $-$currday
ficp /dev/null nohup.out
#nohup ./ggservice.sh
注釋後,是這麼寫的:
:<<'
#!/bin/bash
export path=~/gogoal_platform/ggopenapi:~/play-
1.2.7
:$path
echo "構建後的路徑pwd:"`pwd`
whoami
cd /home/developer/gogoal_platform/ggopenapi/api/ggservice/
cur=$(pwd)
currday=`date +%y%m%d`
# 打包的檔名
filename="ggservice-dataservice"
backup=`find . -name "
$-*" | xargs ls -t | head -n
3|xargs|sed "s/.\///g"|xargs|sed "s/ /\\\\\\|/g"`
echo "保留最近三個備份包:" \"
$backup
\"echo "刪除的備份包:"`ls | grep "
$-.*" | grep -v
$backup
`#刪除ggservice的備份包
rm -rf `ls | grep "
$-.*" | grep -v
$backup
| xargs | sed "s/ / /g"`
#建立最新的備份包
gogalwebfile=$/
$-$currday
if [ ! -f
$gogalwebfile
]; then
echo "不存在":
$gogalwebfile
cp -r
$.jar $-
$currday
ficp /dev/null nohup.out
#nohup ./ggservice.sh
'
shell 多行注釋 2
由於shell不支援直接多行注釋,總結了以下shell注釋多行的變通方法 一 通過here documents和 實現 1 最簡單方法 注釋內容 block 把輸入重定義到前面的命令,但是 是空命令,所以就相當於注釋了。如果注釋中有反引號的命令就會報錯。反引號部分沒被注釋掉,例如ab ls l ab...
shell 多行注釋詳解
在我們寫 shell 指令碼的時候,特別在除錯的時候經常需要注釋多行命令,但在每一行前輸入 顯得有些麻煩。基於 shell 命令的靈活性,我們可以使用下面的方法 方法一 這是比較穩妥的作法 可以採用here document特性,實現多行注釋,比如 comment comment舉例如下 bin b...
shell多行注釋詳解
我們寫shell指令碼時,經常需要注釋多行,但在每一行前輸入 有些麻煩。基於 shell命令的靈活性,我們可以使用下面的方法。格式 comment comment例子 bin bash echo say something 1 注釋行2 注釋行n comment冒號 可用於多行注釋。格式 空格 單引...