#!/bin/bash
#Number for .txt files
txtnum=0
#Number of .sh files
shnum=0
for file in "SOME_PATH";do
#if file has extension .txt
if [[ $file ==* ".txt"]]
then
#increment the number of .txt files (txtnum)
txtnum++
elif [[ $file ==* ".sh"]]
then
#increment the number of .sh files (shnum)
shnum++
fi
echo "Number of files with .txt extension:$txtnum"
echo "Number of files with .sh extension:$shnum"
The above code does not work, but it presents the logic I want it to have.
New to bash
, commands might not be right either.