Skip to content
Snippets Groups Projects
Commit f4973c5e authored by ab5e20's avatar ab5e20
Browse files

A script that uses for loops and the wc command which reads the number of lines

parent c7ed7362
No related branches found
No related tags found
No related merge requests found
loop.sh 0 → 100755
#!/bin/bash
#Basic for loop
for i in {1..10}
do
echo hello $i
done
#For loop for files
for file in ./*
do
numLines=$(wc -l < $file)
echo The file $file contains $numLines lines of text
done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment