2023年12月26日星期二

[shell script] 計算執行時間的一個example

 #!/bin/sh

start=$(date +%s)

#The thing you want to do
echo "testing the echo duration"
sleep 3

end=$(date +%s)
duration=$(( end - start ))
echo "The total excution time is ${duration} seconds."

最後會印出執行的秒數,如下圖:







沒有留言:

發佈留言

使用 lsblk 印出 emmc 每個 partition的"名字"與"size"

使用以下的command可以印出 eMMC的 partition資訊 lsblk --bytes --output name,partlabel,size   參數說明 --bytes: partition的大小,以byte的方式輸出 --output: 後面可以指定要輸出的內容...