-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added different style of using for loop in bash
- Loading branch information
1 parent
c0e80d1
commit a1e5c4e
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |