0
我想要做的是:連接多個命令
>STRIPPER='sed s/admin_editable=\"[01]\"// | sed s/runtime_editable=\"[01]\"//'
>cat file.txt | $STRIPPER > stripped.txt
即定義一個shell變量是多個命令的管道(我碰巧sed
的),我然後可以再打電話。我現在正在從命令行執行此操作,但最終可能會將其放入腳本中。
我都試過「和」爲
sed: can't read |: No such file or directory
sed: can't read sed: No such file or directory
sed: can't read s/admin_editable=\"[01]\"//: No such file or directory
sed: can't read |sed: No such file or directory
sed: can't read s/runtime_editable=\"[01]\"//: No such file or directory
sed: can't read |: No such file or directory
封閉命令既不的作品。我知道有可能是一個單一的正則表達式,可以處理這種情況,但我想知道如何做管道一般
流水線是shell語法的一部分,因此在任何參數擴展發生之前都會被識別出來。 – chepner