我一直在嘗試縮進 git clone 的輸出。我嘗試使用 sed 但它不起作用......這是我迄今為止嘗試過的。
git clone https://github.com/test/HelloWorld --progress | sed 's/^/ /g'
有沒有人有任何想法?
uj5u.com熱心網友回復:
Git 輸出到標準輸出和標準錯誤。要過濾兩者,您可以使用|&或2&1 |。
它還列印使用\r回車更新的進度行。除了普通行之外,您還可以使用正則運算式來縮進這些行。我還將-u用于無緩沖的輸入和輸出。
git clone https://github.com/test/HelloWorld --progress |&
sed -ur 's/(^|\r)/\1 /g'
請注意,它sed是基于行的,并且僅在遇到\n換行符時才列印輸出。用\r回車分隔的行可以在列印之前緩沖一段時間。
uj5u.com熱心網友回復:
一旦我發現pr:
git clone https://github.com/test/HelloWorld --progress 2>&1 | pr -tro 3
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/409099.html
標籤:
上一篇:如何從以前的提交中恢復檔案?
