About 341,000 results
Open links in new tab
  1. 9 Examples of for Loops in Linux Bash Scripts - How-To Geek

    If you're looking to write your first for loop, these simple examples will get you started. You can run a for loop on the command line. This command creates and executes a simple for loop. …

  2. How do I write a 'for' loop in Bash? - Stack Overflow

    Sep 8, 2008 · Bash 3.0+ can use this syntax: for i in {1..10} ; do ... ; done ...which avoids spawning an external program to expand the sequence (such as seq 1 10). Of course, this has …

  3. Looping Statements | Shell Script - GeeksforGeeks

    Jan 3, 2024 · Practical examples illustrate the implementation of loops, including iterating over color values, creating infinite loops, and building an interactive loop for user input validation. …

  4. for loop syntax in shell script - Ask Ubuntu

    The most portable way is to use a shebang (#!/bin/bash or preferably #!/usr/bin/env bash) as the first line of your script. In this way you can run the script from any shell by ./script.sh , the script …

  5. bash - How to make a for loop in command line? - Unix & Linux …

    Jul 12, 2017 · Let's take a simple for loop. echo $i. AFAIK semicolon in bash scripts makes shell execute current command synchronously and then go to the next one. Pressing enter does …

  6. Bash For Loop Examples - nixCraft

    Jan 31, 2025 · Explains how to use a Bash for loop control flow statement on Linux / UNIX / *BSD / macOS bash shell with various programming examples.

  7. 10 Common Bash “for” Loop Examples [Basic to Intermediate]

    Mar 17, 2024 · 10 Common Bash scripting examples of using the "for" loop to generate patterns, different mathematical sequences, passwords, etc.

  8. Bash For Loop with practical examples - FOSS Linux

    Apr 14, 2020 · Bash programming enables users to run a task again and again by use of Loops. In this article, we will look at the For Loop statement. A For Loop statement is used to execute …

  9. Bash Scripting - For Loop - GeeksforGeeks

    Sep 15, 2023 · Depending on the use case and the problem it is trying to automate, there are a couple of ways to use loops. Simple For loop; Range-based for loop; Array iteration for loops; …

  10. Bash for loop examples - LinuxConfig

    With a Bash for loop on a Linux system, it is possible to continue executing a set of instructions for a certain number of files or until a particular condition is met. Loops can be used in Bash …

Refresh