我是一個R用戶,並且正在嘗試使用運行在bash(FFmpeg)中的程序進行循環。對我來說創建一個向量然後在for循環中使用該向量似乎很自然。例如,這是我會在R請勿:如何將文件名與空間分配給向量?
f <- c("File name that is identifier 01.avi", "File name that is identifier 02.avi", "File name that is identifier 03.avi")
for i in 1:length(f) {for loop}
如何分配名稱在bash的載體?
下面是我嘗試和運行存在以下問題:
f=["File name that is identifier 01.avi" "File name that is identifier 02.avi" "File name that is identifier 03.avi"]
bash: File name that is identifier 02.avi: command not found
擊似乎確定我的文件名作爲命令,在這種情況下運行它們
let f=["File name that is identifier 01.avi" "File name that is identifier 02.avi" "File name that is identifier 03.avi"]
bash: let: f=[File name that is identifier 01.avi: syntax error: operand expected (error token is "[File name that is identifier 01.avi")
在這裏,我清楚地做有問題。
如果我只對一個文件執行此操作,它將起作用。隨着支架或無:
f=["File name that is identifier 01.avi"]
# echo $f
[File name that is identifier 01.avi]
我知道我不應該在評論中表示感謝,但你的回答非常有幫助。謝謝你在SO =繼續保持良好的工作) – Mikko