siva siva - 11 months ago 35
Bash Question

How to store and iterate the list of files in a directory(each file need to pass as a input for java module)

i am new to the shell script . i have a requirement that i need to pass a input file (one at a time)for the java program.i have a multiple inputfiles in the to store and iterate the input files.any code snippet for this is helpful .thanks in advance


Something on the below lines.
Create array of files

files=$(ls <directory name with complete path which contains all the files>)
e.g: files=$(ls /tmp/siva/)

Access items from an array:

for i in "${files[@]}";
java <your classname> $i;


Let me know if you need further help