2017-04-02 64 views
-1

我的代碼段中,如下回聲線:

echo "$(wc -l prov_bulk) provisioning commands found between $t_stmp1 of $(head -1 file_list) till $t_stmp2 of $(tail -1 file_list)" 

預期輸出:

1054721 provisioning commands found between 2017033023 of 170330.AUG till 2017033102 of 170331.AUG 

輸出得到:

1054721 prov_bulk provisioning commands found between 2017033023 of 170330.AUG till 2017033102 of 170331.AUG 

爲什麼文件名「prov_bulk」也出現?如何擺脫這一點?

+0

閱讀'wc'的文檔。 – chepner

+1

文件名是您的命令輸出的一部分。它完美地展開。 –

回答

1

通過簡單地添加一個<應該解決您的問題。重定向忽略文件名。

echo "$(wc -l < prov_bulk) provisioning commands found between $t_stmp1 of $(head -1 file_list) till $t_stmp2 of $(tail -1 file_list)"