One line for loop


for i in $(seq $START $STEP $END); do echo "Iteration $i"; someCommand; someOtherCommand ; done

*INFO: $START: The starting value for the for loop, can be replaced by an integer.
$STEP: The step that the for loop is performing at the end of each iteration, can be replaced by an integer.
$END: The ending value for the for loop, can be replaced by an integer.

*NOTE: All kinds of bash for loops can be coded as above and made into one liners.

This post is also available in: Αγγλικα

Απάντηση

Αυτός ο ιστότοπος χρησιμοποιεί το Akismet για να μειώσει τα ανεπιθύμητα σχόλια. Μάθετε πώς υφίστανται επεξεργασία τα δεδομένα των σχολίων σας.