I have a bash script that does something like this:
java -jar executablefile.jar --width 100 --speed 50 --ouput outfile.mp4 --input file1.dat file2.dat file3.dat (etc)
I am able to read all the files in the directory like so:
dir=~/location/to/files
for f in "$dir"/*; do
echo "$f"
done
The above test shows all the files. So I can get one file at a time into $f. However I need to (probably in that loop) concatinate each filename string (including path I believe) into a variable that I can use like so:
java -jar executablefile.jar --width 100 --speed 50 --ouput outfile.mp4 --input $listOfFileNamesWithSpaceBetweenEachFile
I can't for the life of me find anything like this. Does anyone have any suggestion?
Thank you.
UPDATE Further to communication, it turns out I was a little wrong. It needs to be something like this:
-- input /path/to/filename1.gpx --input /path/to/filename2.gpx --input /path/to/filename3.gpx etc
So I was able to get a string via the following:
VAR=""
dir=~/location/to/files
for f in "$dir"/*; do
echo ${f}
VAR+="--input ${f} "
done
`
Thank you everyone for your help!
--input = file1.dat file2.dat file3.dat
? Do you want this to be a single command line argument or separate arguments--input
=
file1.dat
file2.dat
file3.dat
. Please [edit] your question to add this information/clarification. – Bodo Jan 31 '22 at 13:25java ... --input foo.dat bar.dat
, and doesn't need e.g.java ... --input foo.dat --input bar.dat
? – ilkkachu Jan 31 '22 at 13:33java -jar executablefile.jar --width 100 --speed 50 --ouput outfile.mp4 --input "$dir"/file*.dat
work? – Bodo Jan 31 '22 at 15:05