命令是在;
/etc/crontab
在crontab 中可以指定以哪一個 user 的身份來 run command
但是並不包含該 user 環境變數。
所以 run 起來會和真的以該user run 該 script 的結果不同。
為了解決這個問題,
可以在 command script 的開頭加入:
. .profile
/etc/crontab
. .profile
$?
cd mydir
if [ "$?" -ne "0" ]; then
echo failed
else
echo success
fi
make -j4 2>&1 | tee makelog
這時候用 $? 就會是 tee 這個 command 執行的結果,不是 make 的
make -j4 2>&1 | tee makelog
if [ "${PIPESTATUS[0]}" -ne "0" ]; then
echo failed
else
echo success
fi
<name>Charles</name>
<id>123</id>
<color>red</color>
...
<.*> \(.*\) <\/.*>
sed 's/ <.*>\(.*\)<\/.*> / \1 /' file
一樣用 s 指令。sed 's/ <id>\(.*\)<\/id> / \1 /' fileSTRINGLIST="a b c_d e,f"
for ele in $STRINGLIST
do
echo $ele
done
a
b
c_d
e,f
SARY="a"
SARY=$SARY" b"
SARY=$SARY" c"
echo $SARY
a b c
dd if=/dev/zero of=10G bs=1G count=10
這樣會花一些時間,硬碟把 00 寫入 10G 的 file。dd if=/dev/zero of=10G bs=1 count=0 seek=10G
這樣馬上就可以create 出來。<N_Series>MyBrowser.apk</N_Series>
# mount -o uid=charles-chang,gid=charles-chang /dev/sdd1 ~/sdmount -t cifs -o username=softwaretest,password=softwaretest,iocharset=utf8,uid=charles-chang,gid=charles-chang //192.168.147.225/ODM3 /home/charles-chang/buildingmachine