bash script loop through two variables in lock step -


i'm trying write bash script loops through 2 variables:

#!/bin/bash in sd fd dir && j in storage file director     echo "restarting bacula $j daemon"    /sbin/service bacula-$i restart    echo done 

the code above wrong. want & j move in lock step 1 another. can me way achieve this?

thanks

#!/bin/bash a=(sd fd dir) b=(storage file director) k in "${!a[@]}"    echo "restarting bacula ${b[k]} daemon"    /sbin/service "bacula-${a[k]}" restart    echo done 

Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -