Guest User

Untitled

a guest
Feb 20th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. LAN_IP="192.168.1.1"
  4. LAN_MASK="255.255.255.0"
  5. LAN_GW="192.168.1.254"
  6.  
  7.  
  8. echo "hello world" | wc -w
  9.  
  10. wc -w <<< "hello world"
  11.  
  12. grep "dev" <<<`ls -1 /` >/dev/null && echo "Found" || echo "Not found"
  13.  
  14. grep "windows" <<<`ls -1 /` >/dev/null && echo "Found" || echo "Not found"
  15.  
  16.  
  17. cat << EOF > /tmp/a
  18. allow-hotplug eth0
  19. iface eth0 inet static
  20. address $LAN_IP
  21. netmask $LAN_MASK
  22. gateway $LAN_GW
  23. EOF
  24.  
  25. # je potreba escapovat, co se nema dosadit/vyhodnotit
  26. cat << EOF > /tmp/b
  27. allow-hotplug eth0
  28. iface eth0 inet static
  29. address $LAN_IP
  30. netmask $LAN_MASK
  31. gateway $LAN_GW
  32. dns-nameservers \$LAN_GW
  33. EOF
  34.  
  35. # 'EOF' - apostrof zajisti nenahrazovani promennych
  36. cat << 'EOF' > /tmp/c
  37. allow-hotplug eth0
  38. iface eth0 inet static
  39. address $LAN_IP
  40. netmask $LAN_MASK
  41. gateway $LAN_GW
  42. EOF
  43.  
  44. # <<- pomlcka dovoli cely oblok odsadit od zacatku radku, jinak musi byt EOF na prvnim sloupci
  45. cat <<- 'EOF' > /tmp/d
  46. allow-hotplug eth0
  47. iface eth0 inet static
  48. address $LAN_IP
  49. netmask $LAN_MASK
  50. gateway $LAN_GW
  51. EOF
  52.  
  53. cat <<- EOF > /tmp/e
  54. allow-hotplug eth0
  55. iface eth0 inet static
  56. address $LAN_IP
  57. netmask $LAN_MASK
  58. gateway $LAN_GW
  59. EOF
  60.  
  61. cat <<- KonecTextu > /tmp/f
  62. allow-hotplug eth0
  63. iface eth0 inet static
  64. address $LAN_IP
  65. netmask $LAN_MASK
  66. gateway $LAN_GW
  67. KonecTextu
Add Comment
Please, Sign In to add comment