Using Indexed Arrays
Learn how to operate on files using an indexed array and clean it afterward.
We'll cover the following...
Copying files using an array
Here is an example of how we can use arrays to operate on files. Let’s suppose the files
array contains a list of file names. We want to copy the first file in the list. The following cp
call does that:
cp "${files[0]}" ~/Documents
Most programming languages ...