下午好,需要将秒转换为毫秒。脚本:
#!/bin/bash
a=$(ffprobe -i c848a39afc54e04cc64ddd955686654b9b1c6f31 -show_entries format=duration -v quiet -of csv="p=0");
b=1000;
result=$(($a*$b));
echo $result
输出
./sectomilisec: line 4: 23.760000*1000: syntax error: invalid arithmetic operator (error token is ".760000*1000")
最佳答案
bash
不支持浮点运算。您可以为此使用 bc
:
result=$(echo "$a*$b" | bc)
关于linux - 乘以命令输出的数量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38850792/