私は R ユーザーであり、bash (FFmpeg) で実行されるプログラムで for ループを使用しようとしています。ベクトルを作成し、そのベクトルを 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
この場合、Bashは私のファイル名をコマンドとして識別し、それらを実行するようです
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")
ここで私は明らかに何か間違ったことをしています。
これを1つのファイルに対してのみ行うと、機能します。ブラケットの有無にかかわらず:
f=["File name that is identifier 01.avi"]
# echo $f
[File name that is identifier 01.avi]