I try to write a script for get some software's version from many servers. But I get this error message, when i try.
bash: Postfix verzio: MariaDB verzio: OS verzio: Java verzio: : command not found
bash: postfixverzio: command not found
Null message body; hope that's ok
#!/usr/bin/env bash
parancsok=$(<verziok_lekerdezese.sh)
while read line
do
array=($line)
echo "IP Addresses : ${array[0]} "
ssh -t -t root@${array[0]} ${parancsok}
done < ipcimek_test.txt
Verziok_lekerdezese.sh:
postfixvr = $(postconf -d | grep -m 1 mail_version | cut -d= -f2)
mariadbvr = $(mysql -v)
osvr = $(cat /etc/redhat-release)
javavr = $(java -version)
hostname = $(cat /etc/hostname)
body = "Postfix verzio: $postfixvr MariaDB verzio: $mariadbvr OS verzio: $osvr Java verzio: $javavr"
echo $body | mail -s "Verziok - Szervernev: $hostname" [email protected]
exit
I apologize for my bad english.
You need to remove the spaces on both sides of equal char
=
(in the assignment statements) in your bash script. So, the lines:should be written as:
This applies to all assignments including
body =
also.