我一直在试图创建一个脚本来使用ffmpeg的网站下载的文件,它工作得很好,直到它得到的文件名,代码是这样:ffmpeg的不采取对文件名变量在bash
echo "Hello, this is the basic script to download videos. This requires ffmpeg to be installed, do you want to start? (Y/N)"
read start_input
if [ $start_input = Y ] || [ $start_input = y ]
then
echo "[Text]"
read video_link
echo "Now I need what quality you want the video to be (240, 360, 480, 720, 1080, Default: 720)"
read quality_link
if [ -z $quality_link ]
then
$quality_link = "720"
fi
echo "Now name the new file (Note, it will have a .ts extention)"
read $new_file
echo "And where would you like it to be placed?"
read $folder_location
$file="${folder_location}/${new_file}.ts"
ffmpeg -i "[url]" -c:v copy -c:a copy -f mpegts $file
else
exit 0
fi
exit 0
问题是什么时候使用$ file变量,ffmpeg没有使用它,变量被完全忽略,我尝试了许多不同的方法,但他们不工作(单引号,双引号,使用$ {file}) , 我能做什么?
欢迎使用stackoverflow!给[shellcheck](http://shellcheck.net)一个尝试 - 在这种情况下它说“不要在作业左侧使用$”。还有其他一些建议。 –
您可以使用'-c copy'而不是'-c:v copy -c:a copy'来保存几位数据。 – LordNeckbeard
其他人,我已经试过这个,但它不起作用,我试过用斜线分隔的原始输入,它试图写/所以这不是问题 – 2haloes