Is it possible to cat array elements that are text files passed as input? I have something like this:
array=("$@")
cat array[3]
Where first I put all my arguments (some files.txt) into an array to handle them later and then for example I'd like to print the body of the third file (I know I could easily use cat $3
).
cat "${array[3]}"
; have a look at shellcheck to prevent this kind of syntax errors in shell scripts. Addendum: numbering of array indices startes at 0 unless manually specified. – AdminBee Apr 14 '20 at 09:35