daily pastebin goal
52%
SHARE
TWEET

bash script in ubuntu 16

a guest Nov 17th, 2016 108 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ###This is a script (test.sh) that tries to include a file:
  2.  
  3. #!/bin/bash
  4.  
  5. #INCLUDE TARGETS
  6. . ~/config.conf
  7.  
  8. ##
  9. ##This is what is in ~/config.conf, and notice that there is no shebang at the start of the file:
  10. ##
  11.  
  12. USER1HOME="/home/user1"
  13. ECHO="/bin/echo"
  14.  
  15. . ~/detect_os.fnc
  16. detect_os;
  17.  
  18. ##
  19. ##This is what is in ~/detect_os.fnc
  20. ##
  21.  
  22. detect_os() {
  23.         UBUNTU_VER_DETECTED=`lsb_release -d`
  24.  
  25.         if [ "$UBUNTU_VER_DETECTED" == "Description:    Ubuntu 16.04.1 LTS" ] ; then
  26.                 CHOWN="/bin/chown"
  27.                 ECHO="/bin/echo"
  28.                 GZIP="/bin/gzip"
  29.                 RM="/bin/rm"
  30.                 TAR="/bin/tar"
  31.                 TIME="/usr/bin/time"
  32.                 OS="Ubuntu"
  33.                 OS_VER="16"
  34.  
  35.                 ${ECHO} ${USER1HOME}
  36.  
  37.         elif [ "$UBUNTU_VER_DETECTED" != "Description:    Ubuntu 16.04.1 LTS" ] ; then
  38.             exit 1
  39.         fi
  40. }
RAW Paste Data
Top