Devops-Practical-Problem-8

Practical Problem:Suppose if you have multiple files in a server, and you want to check whether files are empty or not.How will you check this ?

Solution:
#!/bin/bash
for j in $(cat file-name.txt)
do
b=`ssh hostname cat $j | wc -l`
if [ "$b" == "0" ]
then
echo "File is  empty"
else 
echo "File is not empty"
fi 
done

For more practical problems Please click on below link:

Comments

Popular posts from this blog

Python & Shell Scripting Real Time Course Book & Videos

Top Five Devops Technical Interview QA Books

Linux-Command Hands-On (DF)