Whats the best way to achieve the following?
I want my script to find out which postion the host its running on is in a list of hosts.
thisHost=$(hostname)
machineList="pc02 server03 host01 server05"
So if thisHost=host01 I would get back postion 3.
The machine list would never be contain more than 10 items.
I could do a comparison match in a for loop but would like to know if there is a better way ?