How to assign file names with spaces to vectors?
I am an R user, and am trying to use for loops with a program that runs in
bash (FFmpeg). It seems natural to me to create a vector and then use that
vector in the for loop. For example, this is what I would do in 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}
How do I assign names to a vector in bash?
Here is what I tried and run to following problems:
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
Bash seems to identify my file names as commands and run them in this case
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")
Here I am clearly doing something wrong.
If I do this for one file only, it works. With the brackets or without:
f=["File name that is identifier 01.avi"]
# echo $f
[File name that is identifier 01.avi]
No comments:
Post a Comment