Cat 和/或將多個內容回顯到「一個命令列」上的一個檔案中

Cat 和/或將多個內容回顯到「一個命令列」上的一個檔案中

我知道我們可以做這樣的事情:

stat -f%z mybigfile > RELEASENOTES.txt

echo "bytes" >> RELEASENOTES.txt

現在 RELEASENOTES.txt 將如下所示:

47556304
bytes

如何在同一行取得「位元組」?這是我的目標,但如果我只知道如何在 OS X 終端命令列上連接字串,那麼我就可以做到。無論哪個答案都可以:-)

答案1

目前狀態:

BIGFILE=myverybigfile
echo File size: $(stat -f%z ${BIGFILE}) bytes > RELEASENOTES
echo ${whatissnewinthisbuild} >> RELEASENOTES

知道了!像這樣的東西:(舊)

BIGFILE="myverybigfile"
echo "File size:" `stat -f%z ${BIGFILE}` "bytes" > RELEASENOTES
echo "${whatissnewinthisbuild}" >> RELEASENOTES

相關內容