Some time ago I have written a bash script which now should be able to run in environment with ash.
In bash it was like :
services=( "service1.service"
"service2.service"
"service3.service" )
for service in "${services[@]}"
do
START $service
done
START()
{
echo "Starting "$1
systemctl start $1
}
In reality there are like 40 services in array, and I want to make this transition as painless and clean as possible. Have always been using bashisms. Now I'm in a pinch with the task to make scripts more portable.
For portability reasons probably it would be nice to have a pure ash solution. But since I have a pretty robust busybox at my disposal I might sacrifice some portability. Only if readability improves a lot, since "clean" script is a metric too.
What would be portable and clean solution in this case?