我一直在試圖創建一個腳本來使用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