Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Shells Virtual Desktop
BMail.ag - Secure Email Service
Server.net
CPLicense.net
VPS Server
Buy VPN
Vultr
VMs for AI
HostDare
HostDare
ReliableSite White-Label Dedicated Hosting for Resellers
25% Recurring Discount on NVMe VPS
InterServer VPS
BMail.ag - Secure Email Service
Best VPN
High-Performance Bare Metal Server Solutions
Karvl.com
Server Mania Cloud Hosting
DataWagon Hosting
AlphaVPS Hosting
Evoxt.com
Clouvider
VPS Hosting with NVMe
Residential IPs in the US & 4G Mobile Proxies in EU & US with Unlimited Bandwidth
ReliableSite White-Label Dedicated Hosting for Resellers
Rabisu - Hosting Solutions
Shells Virtual Desktop
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Scripts Detect Network Interface Centos

Hi,

This is my scripts detect network interface in centos (eth vs venet).

#!/bin/sh
RED='\033[01;31m'
GREEN='\033[01;32m'
RESET='\033[0m'
clear

if [ "/sbin/ifconfig | grep venet" ];then
        echo -e "[ $GREEN venet $RESET ]"
else
        echo -e "[ $RED eth0 $RESET ]"
fi

when i test script it have error

: command not foundne 5: clear
: command not foundne 6:
testifconfig.sh: line 12: syntax error: unexpected end of file

Someone can fix it for me?

Regards,

Comments

  • 
    #!/bin/sh
    RED='\033[01;31m'
    GREEN='\033[01;32m'
    RESET='\033[0m'
    clear
    
    /sbin/ifconfig | grep venet >/dev/null 2>&1
    RET=$?
    if [ $RET -eq 0 ]; then
      echo -e "[ $GREEN venet $RESET ]"
    else
      echo -e "[ $RED eth0 $RESET ]"
    fi
    
    
  • : command not foundne 5: clear
    : command not foundne 6:
    : ambiguous redirecte 7: 1
    testifconfig.sh: line 14: syntax error: unexpected end of file
    
  • imchandaveimchandave Member
    edited September 2014

    Are you creating testifconfig.sh on a Windows machine and then uploading it to your CentOS machine?

    If that's the case the problem might be end-of-line markers. Use dos2unix to convert the '\r\n's time '\n's.

    For the "clear" problem, make sure you have the program in your path.

    See ya...

    d.c.

  • It working now. Thank you. Mod can closed topic.

Sign In or Register to comment.