Issue
I would like to check all accounts that they do have access to a server partition for how much budget they have consumed. The command to do that is the following:
accuse -u "accountName0040"
There are in total 30 accounts and they all follow the same naming with different indexing. I would like to loop through all these accounts run this command and extract the outcome. How can I do that thing with shell script?
My idea is to do something like:
#!/bin/bash
while #"a button is pressed"
COUNTER = 40
do
accuse -u "accountName"COUNTER
echo # the outcome of the command
COUNTER=$((COUNTER+1))
done
Solution
You could use seq -f
to generate the list of account identifiers:
#!/bin/bash
START=40
for aid in `seq -f "accountName%04g" $START $(($START + 29))`
do
accuse -u $aid
done
Answered By - Mathias R. Jessen Answer Checked By - Candace Johnson (WPSolving Volunteer)