且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何隐藏或在我的bash脚本删除零?

更新时间:2023-12-05 19:29:40

以下部分添加到您的sed命令(在末尾):

Add the following part to your sed command (at the end):

-e 's/\.0*$//'

(删除一个点,然后在通过没有结束任意多个零)。

(Delete a dot followed by arbitrarily many zeroes at the end by nothing.)

顺便说一句,你***更换回声$ bil1 * $ bil2 回声$ bil1 * $ bil2,否则你可能会根据当前目录的内容得到奇怪的效果。

By the way, you better replace echo $bil1*$bil2 by echo "$bil1*$bil2", otherwise you may get strange effects depending on the contents of the current directory.