Skip to content

Commit

Permalink
Reading file with For loop
Browse files Browse the repository at this point in the history
  • Loading branch information
Prateek Bhaisora authored and Prateek Bhaisora committed Jan 23, 2024
1 parent d5b0a29 commit 01af09d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions 15_forloop-file.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# Getting values from a file names.txt

FILE="/Users/prateek/Desktop/Shell-Scripting/names.txt"

for name in $(cat $FILE)
do
echo "Name in file is: $name"
done
5 changes: 5 additions & 0 deletions names.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Raju
Shyam
Baburao
Paul
Alex

0 comments on commit 01af09d

Please sign in to comment.