check_os.sh 701 B

1234567891011121314151617181920212223242526
  1. #!/bin/bash
  2. # Author: yeho <lj2007331 AT gmail.com>
  3. # Blog: http://blog.linuxeye.com
  4. if [ -f /etc/redhat-release -o -n "`grep 'Aliyun Linux release6 15' /etc/issue`" ];then
  5. OS=CentOS
  6. elif [ -n "`grep bian /etc/issue`" ];then
  7. OS=Debian
  8. elif [ -n "`grep Ubuntu /etc/issue`" ];then
  9. OS=Ubuntu
  10. else
  11. echo -e "\033[31mDoes not support this OS, Please contact the author! \033[0m"
  12. kill -9 $$
  13. fi
  14. OS_command()
  15. {
  16. if [ $OS == 'CentOS' ];then
  17. echo -e $OS_CentOS | bash
  18. elif [ $OS == 'Debian' -o $OS == 'Ubuntu' ];then
  19. echo -e $OS_Debian_Ubuntu | bash
  20. else
  21. echo -e "\033[31mDoes not support this OS, Please contact the author! \033[0m"
  22. kill -9 $$
  23. fi
  24. }