Lupisak

Ronny Ager-Wick's blog for techie stuff (GNU/Linux, programming (mostly Ruby, bash), databases, etc)

Friday, 29 June 2012

Linux bash for loop (repeat command n times)

# one liner:
for i in {1..10}; do echo "$i"; done;

# shell script:

#!/bin/bash
for i in {1..10}
do
  echo "$i"
done

# note: this works in bash, but *not* in sh.
Posted by Ronny Ager-Wick No comments:
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: bash, command line, console, for loop, GNU, GNU/Linux, linux, loop, shell
Newer Posts Older Posts Home
Subscribe to: Posts (Atom)

About Me

Ronny Ager-Wick
View my complete profile

Blog archive

  • ►  2016 (1)
    • ►  August (1)
  • ►  2015 (1)
    • ►  April (1)
  • ►  2014 (7)
    • ►  December (1)
    • ►  November (4)
    • ►  August (1)
    • ►  July (1)
  • ►  2013 (8)
    • ►  July (1)
    • ►  June (2)
    • ►  May (1)
    • ►  April (1)
    • ►  March (3)
  • ▼  2012 (2)
    • ▼  June (1)
      • Linux bash for loop (repeat command n times)
    • ►  March (1)
Awesome Inc. theme. Theme images by imagedepotpro. Powered by Blogger.