1. 變數=`command`
ex:
nowDate=`date +%s`
2. 變數=$(command)
ex:
nowDate2=$(date +%s)
寫一個測試shell script
========== command.sh =============
#!/bin/sh
nowDate=`date +%s`
nowDate2=$(date +%s)
echo "nowDate=$nowDate"
echo "nowDate2=$nowDate2"
=================================
實際測試結果,如下圖:
沒有留言:
張貼留言