Skip to content

Commit

Permalink
Added different style of using for loop in bash
Browse files Browse the repository at this point in the history
  • Loading branch information
khagapati-bagh committed Oct 1, 2021
1 parent c0e80d1 commit a1e5c4e
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions bash/for_loop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
echo "Different style of using for loop"
echo -e "\nStyle #1"
words="This is the right place to learn and sahre your skills"
for word in $words
do
echo $word
done
echo -e "\nStyle #2"
for word in Directly accessing value
do
echo $word
done
echo -e "\nStyle #3"
for ((i = 1; i <= 10; i++))
do
echo $i | tr '\n' ' '
done
echo -e "\n\nThank You"3

0 comments on commit a1e5c4e

Please sign in to comment.