sandervanvugt

Untitled

Aug 3rd, 2020
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.15 KB | None | 0 0
  1. [root@localhost bash-scripting]# cat script2b
  2. #!/bin/bash
  3.  
  4. . colors
  5. echo the color is $COLOR
  6.  
  7.  
  8. [root@localhost bash-scripting]# cat colors
  9. COLOR=red
  10.  
  11. [root@localhost bash-scripting]# cat script4b
  12. #!/bin/bash
  13.  
  14. for i in "$@"
  15. do
  16. echo useradd $i
  17. done
  18.  
  19. root@localhost bash-scripting]# cat script9b
  20. #!/bin/bash
  21. #
  22. # documentation
  23. # exit code 3 means no argument provided
  24.  
  25. if [ -z $1 ]
  26. # if test -z $1
  27. then
  28. echo please enter a value
  29. read VALUE
  30. else
  31. VALUE=$1
  32. fi
  33.  
  34. echo the argument is $VALUE
  35.  
  36. [root@localhost bash-scripting]# cat script11
  37. #!/bin/bash
  38.  
  39. echo are you good?
  40.  
  41. read GOOD
  42.  
  43. GOOD=$(echo $GOOD | tr [:upper:] [:lower:])
  44.  
  45. case $GOOD in
  46. yes)
  47. echo that\'s nice
  48. ;;
  49. no)
  50. echo that\'s not so nice
  51. ;;
  52. *)
  53. echo okay
  54. ;;
  55. esac
  56.  
  57. scripting/
  58. 3 ls
  59. 4 vim script1
  60. 5 script1
  61. 6 echo $PATH
  62. 7 exit
  63. 8 echo $PATH
  64. 9 ./script1
  65. 10 cd bash-scripting/
  66. 11 ./script1
  67. 12 ls -l
  68. 13 chmod +x script1
  69. 14 ./script1
  70. 15 cat script1
  71. 16 ls -l script1
  72. 17 echo $?
  73. 18 ls kiwhgiughwiurghv
  74. 19 echo $?
  75. 20 ./script1
  76. 21 bash script1
  77. 22 sh script1
  78. 23 cat script1
  79. 24 history
  80. 25 chmod -x script1
  81. 26 bash script1
  82. 27 ./script1
  83. 28 chmod +x script1
  84. 29 sh script1
  85. 30 which sh
  86. 31 which bash
  87. 32 ls -l /usr/bin/sh /usr/bin/bash
  88. 33 vim script2
  89. 34 ./script2
  90. 35 chmod +x script*
  91. 36 ./script2
  92. 37 cat script2
  93. 38 pwd
  94. 39 vim script2
  95. 40 source script2
  96. 41 ls
  97. 42 cd bash-scripting/
  98. 43 vim script2
  99. 44 source script2
  100. 45 cd bash-scripting/
  101. 46 source script2
  102. 47 cd -
  103. 48 . script2
  104. 49 cd -
  105. 50 vim script2b
  106. 51 chmod +x script2b
  107. 52 vim colors
  108. 53 ./script2b
  109. 54 chmod +x script2b
  110. 55 vim script2b
  111. 56 vim colors
  112. 57 ./script2b
  113. 58 yum provides */network
  114. 59 yum provides */network | grep init.d
  115. 60 yum provides */network | grep -B 4 init.d
  116. 61 yum install -y network-scripts
  117. 62 cat script2b
  118. 63 cat colors
  119. 64 cat script2
  120. 65 history
  121. 66 cd /etc/init.d/
  122. 67 ls
  123. 68 vim network
  124. 69 ls
  125. 70 pwd
  126. 71 cd /etc/sysconfig/
  127. 72 ls
  128. 73 vim network
  129. 74 cd /root/bash-scripting/
  130. 75 ./countdown 12
  131. 76 cat script2
  132. 77 cat script2b
  133. 78 cat colors
  134. 79 vim countdown
  135. 80 echo $(( 2 + 2 ))
  136. 81 echo $(( 2 * 42 ))
  137. 82 echo $(( 42 /2 ))
  138. 83 vim script3
  139. 84 cat script3
  140. 85 ./script3 a b c d e f g h i j k l m
  141. 86 sleep 5; echo hello
  142. 87 vim script4
  143. 88 cat script3
  144. 89 vim script4
  145. 90 vim ~/.vimrc
  146. 91 vim script4
  147. 92 ./script4 a b c d e
  148. 93 vim script4b
  149. 94 chmod +x script4b
  150. 95 ./script4b bob bill bea
  151. 96 vim script4b
  152. 97 ./script4b bob bill bea
  153. 98 cat script4
  154. 99 cat script4b
  155. 100 vim script3
  156. 101 ./script3 a b c
  157. 102 vim script3
  158. 103 vim script5
  159. 104 cd /lib/modules
  160. 105 ls
  161. 106 uname -r
  162. 107 cd `uname -r`
  163. 108 cd ..
  164. 109 cd $(uname -r)
  165. 110 which vim
  166. 111 ls -l /usr/bin/vim
  167. 112 ls -l $(which vim)
  168. 113 cd
  169. 114 cd bash-scripting/
  170. 115 vim script5
  171. 116 vim script6
  172. 117 cat script6
  173. 118 ./script6 /usr/bin/blah
  174. 119 vim script6
  175. 120 ./script6 /usr/bin/blah
  176. 121 vim script6
  177. 122 MYNAME="sander van vugt"
  178. 123 echo $MYNAME
  179. 124 MYPATH="$PATH"
  180. 125 echo $MYPATH
  181. 126 echo 'uname -r'
  182. 127 echo `uname -r`
  183. 128 vim script6
  184. 129 vim script7
  185. 130 ./script7
  186. 131 vim script7
  187. 132 vim script8
  188. 133 cut -d : -f 1 /etc/passwd
  189. 134 vim script8
  190. 135 vim grepfile
  191. 136 grep alex grepfile
  192. 137 grep xander grepfile
  193. 138 grep ^alex$ grepfile
  194. 139 useradd linda
  195. 140 useradd belinda
  196. 141 useradd melinda
  197. 142 grep linda /etc/passwd
  198. 143 grep ^linda$ /etc/passwd
  199. 144 cut -d : -f 1 /etc/passwd | grep ^linda$ /etc/passwd
  200. 145 cut -d : -f 1 /etc/passwd | grep ^linda$
  201. 146 vim script8
  202. 147 ./script8
  203. 148 vim script8
  204. 149 ./script8 linda
  205. 150 ./script8 inda
  206. 151 vim script8
  207. 152 cat script8
  208. 153 cut -d : -f /etc/passwd | grep ^linda$ >/dev/null && echo she exists || echo she doesnt exist
  209. 154 cut -d : -f 1 /etc/passwd | grep ^linda$ >/dev/null && echo she exists || echo she doesnt exist
  210. 155 cut -d : -f 1 /etc/passwd | grep ^pinda$ >/dev/null && echo she exists || echo she doesnt exist
  211. 156 cat script8
  212. 157 (cut -d : -f 1 /etc/passwd | grep ^pinda$ >/dev/null && echo she exists) || echo she doesnt exist
  213. 158 (cut -d : -f 1 /etc/passwd | grep ^linda$ >/dev/null && echo she exists) || echo she doesnt exist
  214. 159 grep ^alex$ grepfile
  215. 160 grep ^linda$ /etc/passwd
  216. 161 vim script8 script8b
  217. 162 vim script8b
  218. 163 cp script8 script8b
  219. 164 vim script8b
  220. 165 ./script8b linda
  221. 166 vim script9
  222. 167 man test
  223. 168 vim script9
  224. 169 ./script9
  225. 170 echo $?
  226. 171 ./script9 yes
  227. 172 cp script9 script9b
  228. 173 vim script9b
  229. 174 cat script9b
  230. 175 vim script10
  231. 176 ./script10 1
  232. 177 bash -x ./script10 1
  233. 178 vim script10
  234. 179 bash -x ./script10 1
  235. 180 vim script10
  236. 181 bash -x ./script10 1
  237. 182 vim script10
  238. 183 ./script10 1
  239. 184 ./script10 12
  240. 185 ls
  241. 186 vim script10
  242. 187 vim script11
  243. 188 ./script11
  244. 189 vim script11
  245. 190 ./script11
  246. 191 vim script11
  247. 192 echo HELLO | tr [:upper:][:lower:]
  248. 193 echo HELLO | tr [:upper:] [:lower:]
  249. 194 echo HELLO | tr A-Z a-z
  250. 195 vim script11
  251. 196 ./script11
  252. 197 cat script11
  253. 198 ls
  254. 199 vim kube-setup.sh
  255. 200 echo here document
  256. 201 ls
  257. 202 vim lab53.sh
  258. 203 vim lab97.sh
  259. 204 vim rene
  260. 205 vim script11
  261. 206 vim rene
  262. 207 file scripts
  263. 208 vim vbox-setup.sh
  264. 209 cd ..
  265. 210 git clone https://github.com/sandervanvugt/kube4h
  266. 211 git clone https://github.com/sandervanvugt/kub4h
  267. 212 cd kub4h/
  268. 213 ls
  269. 214* vim kube-setup.s
  270. 215 cd ..
  271. 216 git clone https://github.com/sandervanvugt/kubernetes
  272. 217 cd kubernetes/
  273. 218 vim kube-setup.sh
  274. 219 hostnamectl
  275. 220 vim kube-setup.sh
  276. 221 cd
  277. 222 history
Add Comment
Please, Sign In to add comment