I am creating a bash script that will list the files (in this case apache sites are available). Listing files is easy for my ultimate goal - to take each of these files into an array, display them to the user and allow the user to choose which "file" to process, in which case he should include the site.
I'm not very far, I know that I need to set ls as an array, and then encode the action:
array=$(ls) for sites in $array(2) do echo "$sites" done
I know that I need to index each of the files in a directory, and then allow the user to enter a number to include. So it will look like this:
(1) newdomain.com (2) newdomain2.com Which site would you like to enable (ie 1)?
Hope this makes sense?
source share