If then else in shell programming. Count the number of files in current directory, and check … #Linux/Unix: Shell Programming – 001

#!/bin/sh

#count the number of files in current directory, and check if the number is equal to or greater than or less than 26

#NOF represents number of files

NOF=`ls -l | wc -l`

if [ $NOF -eq 26 ]
then
echo “No of files and directories is equal to 26”
fi

if [ $NOF -gt 26 ]
then
echo “No of files is greater than 26”
fi

if [ $NOF -lt 26 ]
then
echo “No of files is less than 26”
fi

exit From: http://sitestree.com/?p=12195
Categories:Linux/Unix: Shell Programming – 001
Tags:
Post Data:2018-04-16 19:23:07

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada