Hi I have a shell script that inserts disk status of linux servers in SQL server. Before inserting the SQL command, the program executes and ends properly. However, when I inserted the SQL command, the .sh file never goes to the next line to execute. It is always in a loop. Kindly help
#!/bin/bash
#Functions here
insert() {
echo "--INSERT FUNCTION--"
echo "$1"
fsname=$1
fs=$(echo "${fsname: -3}")
sqlcmd -S <ipadd> -U <user> -P <pass> -d tech_admin -Q "EXEC insertDiskStatus $fs"
sleep 1
}
echo "TEST"
cd ~/Documents
pwd
df -Ph --exclude-type=tmpfs --exclude-type=ext3 --block-size=GB | column -t | sed 1d > diskspace.log
filename=diskspace.log
while read -r line
do
this=$line
fs=$(echo $line | awk '{print $1}')
insert $fs
done < "$filename"
< /dev/nullto thesqlcmdline?