bash - Bash试图将转换后文件的名称写入文本
问题描述
我有这个脚本,我用它把我的文件转换为 16 位。我想知道哪些文件已被转换,因此我尝试将它们写入列表。但是,即使文件已被转换,创建的文件仍为空。怎么了?
#!/bin/bash
files=()
find . -name "*.wav" -o -name "*.WAV"|while read i; do
if [ "$(ffprobe -v error -show_entries stream=sample_fmt -of csv=p=0 "$i")" != "s16" ] || [ "$(ffprobe -v error -show_entries stream=sample_rate -of csv=p=0 "$i")" != "44100" ]
then
ffmpeg -y -i "$i" -c:a pcm_s16le -ar 44100 "${i%.*}_16.wav";
files+=("$i");
fi
done
printf "%s\n" "${files[*]}" > converted_files.txt;
解决方案
推荐阅读
- css - 使用 scss 导入 Google 字体:MIME 类型冲突
- android - 毕加索在选项卡开关上再次加载图像
- c++ - C++,使用类名调用函数
- ios - 为什么我的多通道映射不能正常工作?
- javascript - 如何正确解析包含非常大数字的 JSON 字符串?
- amazon-web-services - 没有在 MediaPackage 中创建清单,从 AWS 控制台工作
- android - 在 setClickListener 期间以编程方式设置渐变不起作用。为什么?
- go - 如何将变量值 addr、[]net.IP 转换为字符串?
- bash - 从另一个脚本调用时,Curl 无法打开多部分文件
- oracle - 如何在Oracle中添加一个策略,用户可以从表中选择所有数据,并且只能插入、更新、删除有条件的数据