I'm making a script for monitoring some user processes with Upstart but, since its for the company I work for, they asked me to do it generic...how's so? Well, the number of processes being monitored could vary, as in number as in name so I need to create it so a user can input "n" number of processes and give the shell its pathname's so I can store them in variables and pass Upstart a script with them so my question is: how can I create as many variables as needed?
Here's my script so far…
#!/bin/bash FILENAME=$1 i=1 while read LINE do [rutaServ$i]=$LINE echo "ruta -> [rutaServ$i]" i=`expr $i + 1` done < $FILENAME
As you can see I am taking the pathname provisionally from a plain text file with nothing more than
/home/user lines in it but, when I run this script I get the following error
[rutaServ1]=/home/user: The file or directory doesn't exists
What is the correct way of doing this?