I'm getting below error while running a shell script. Kindly help [intention for the script is to check whether current OS version (RHEL/CentOS) is less that 7 or not]
================================== ERROR ==============================
./test.sh: line 5: 7]: No such file or directory
PHP 5.4 will be installed by default
=======================================================================
#!/bin/bash
# Script Name: test.sh
VERSION=`cat /etc/redhat-release|awk '{print $4}'|cut -d "." -f1`
if [ "$VERSION" < "7" ]
then
echo "PHP 5.4 need to be installed separately"
else
echo "PHP 5.4 will be installed by default"
fi`
-ltinstead of<. Also use[[]]instead of[]to prevent the shell from interpreting<and>as file descriptors/operators.