Problemas com este script sh?

0

Tendo problemas ao executar este script sh ... não vejo nada de errado com isso, alguém vê algo que eu estraguei?

echo "**************************************"
echo "***                                ***"
echo "***      Updated Please Read       ***"
echo "***                                ***"
echo "**************************************"
sleep 3
echo "Will updating this OS cause any issues with a control panel? [y|n]"
echo " Answer No for Cpanel, Direct Admin, Webmin, Plesk, VZ."
# CP = 'n'
# read CP

# if [[ ! 'echo $CP | egrep '(y|yes|n|no)'' ]]; then
#
#        echo "Please answer with y or n:"
#        read CP
# fi

echo "Testing for SELinux..."
selinuxenabled

if [[ $? = 0 ]]; then

        echo "disabling SELinux..."
        sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
        setenforce 0
fi

echo "Initial time sync..."
ntpdate -b 204.123.2.72 > /dev/null 2>&1


        if [[ -f /etc/redhat-release ]]; then

                if [[ 'egrep '(4\.[0-9]|\ 5\ |5\.[0-9]|\ 6\.[0-9])' /etc/redhat-release' ]]; then

                        CENT_VERSION='cat /etc/redhat-release'
                else

                        echo "This version of CentOS is not compatible with this script."
                        echo "Please use the old instructions."
                        exit 1
                fi
        else

                echo "You are not running this script on CentOS."
                exit 2
        fi

        if [[ 'echo $CENT_VERSION | grep 4\.[0-9]' ]]; then

                V=4

        elif [[ 'echo $CENT_VERSION | egrep '(\ 5\ |5\.[0-9])'' ]]; then

                V=5
        fi


echo "Updating Resolvers..."

Obtendo este erro:

sh harden.sh
: command not found
**************************************
***                                ***
***      Updated Please Read       ***
***                                ***
**************************************
sleep: invalid time interval '3\r'
Try 'sleep --help' for more information.
Will updating this OS cause any issues with a control panel? [y|n]
 Answer No for Cpanel, Direct Admin, Webmin, Plesk, VZ.
: command not found
: command not found
Testing for SELinux...
: command not found selinuxenabled
: command not found

Parece que algo está mfunky com a formatação?

    
por MasterGberry 12.02.2014 / 22:17

1 resposta

1

Acontece que isso foi relacionado ao Windows adicionar caracteres \ ... existe um utilitário chamado dos2unix que corrige isso, mas eu só fiz isso sozinho, fazendo as poucas mudanças no linux.

    
por 12.02.2014 / 22:25

Tags