shell - shell 错误: redirection unexpected in using bc

标签 shell redirect error-handling printf bc

错误中风:

printf "%15s\t%5d\t%5.2f%%\n" bc <<< "scale=2; 100 * $mac / $totals" > result

我不明白。 BC之前和$ totals之后”是符号`

最佳答案

printf "%15s\t%5d\t%5.2f%%\n" $(bc <<< "scale=2; 100 * $mac / $totals") > result
                              ^^                                      ^

关于shell - shell 错误: redirection unexpected in using bc,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19389852/

相关文章:

php - 有什么简单的方法可以将 Hoptoad 与 CakePHP 一起使用?

linux - 使用 shell 获取父级 PID?

servlets - 如何防止在重定向网址末尾添加 jsessionid

python - 在不占用键盘的情况下将击键发送到非事件的 GUI 应用程序

java - 如何从 RestTemplate 获取重定向的 url?

jquery - .submit() 表单后重定向

php - 使用 PHP 进行错误处理和获取 MySQL 数据

c++ - 无法捕获 std::invalid_argument

regex - 如何使用正则表达式和 shell 从字符串中提取值?

linux - 使用 awk 提取文件的所需部分时出现混淆