Advertisement
sandervanvugt

bash scripting oct22

Oct 27th, 2022
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.61 KB | None | 0 0
  1. [root@localhost bash-scripting]# history
  2. 1 dnf install git -y
  3. 2 git clone https://github.com/sandervanvugt/bash-scripting
  4. 3 cd bash-scripting/
  5. 4 ls
  6. 5 env
  7. 6 echo $USER
  8. 7 key=value
  9. 8 echo $value
  10. 9 echo $key
  11. 10 export key=value
  12. 11 bash
  13. 12 vim /etc/bashrc
  14. 13 echo ${key}
  15. 14 echo ${key}1
  16. 15 echo $key1
  17. 16 ls
  18. 17 echo $?
  19. 18 ls ugiugiuguyguy
  20. 19 echo $?
  21. 20 echo $SHELL
  22. 21 vim example1
  23. 22 chmod +x example1
  24. 23 ./example1
  25. 24 vim /etc/bashrc
  26. 25 example1
  27. 26 echo $PATH
  28. 27 ./example1
  29. 28 vim hello-world.sh
  30. 29 bash hello-world.sh
  31. 30 hello-world.sh
  32. 31 ./hello-world.sh
  33. 32 ls -l hello-world.sh
  34. 33 chmod +x hello-world.sh
  35. 34 ./hello-world.sh
  36. 35 hello-world.sh
  37. 36 echo $PATH
  38. 37 cp hello-world.sh /usr/bin/
  39. 38 hello-world.sh
  40. 39 type ls
  41. 40 type man
  42. 41 type cat
  43. 42 type echo
  44. 43 help
  45. 44 man bash
  46. 45 ls
  47. 46 cat script2
  48. 47 ./countdown 12
  49. 48 cat countdown
  50. 49 echo "this is my $SHELL"
  51. 50 echo 'this is my $SHELL'
  52. 51 echo this is my \$SHELL
  53. 52 echo the value of $SHELL is $SHELL
  54. 53 echo the value of \$SHELL is $SHELL
  55. 54 ls
  56. 55 vim readtit
  57. 56 ./readtit
  58. 57 chmod +x readtit
  59. 58 ./readtit
  60. 59 pwd
  61. 60 echo hello >&2
  62. 61 vim press.sh
  63. 62 chmod +x press.sh
  64. 63 ./press.sh
  65. 64 cat press.sh
  66. 65 vim colors.sh
  67. 66 chmod +x colors.sh
  68. 67 ./colors.sh
  69. 68 vim variables
  70. 69 vim colors.sh
  71. 70 ./colors.sh
  72. 71 vim colors.sh
  73. 72* . colors.sh
  74. 73 vim script2
  75. 74 history
  76. 75 . script2
  77. 76 dnf install network-scripts
  78. 77 cd
  79. 78 cd bash-scripting/
  80. 79 ls
  81. 80 scp root@192.168.29.149:/etc/rc.d/init.d/network .
  82. 81 vim network
  83. 82 vim script3
  84. 83 cat script3
  85. 84 ./script3 a b c d e f g h i j k k l m n
  86. 85 chmod +x script*
  87. 86 ./script3 a b c d e f g h i j k k l m n
  88. 87 cat script3
  89. 88 vim script4
  90. 89 ./script4 a b c d
  91. 90 cat script4
  92. 91 vim script4b
  93. 92 chmod +x script4b
  94. 93 ./script4b lisa linda lori
  95. 94 cat script4b
  96. 95 vim countdown
  97. 96 echo $(( 2 + 5 ))
  98. 97 echo $(( 2 * 5 ))
  99. 98 vim countdown
  100. 99 ./countdown 1
  101. 100 vim countdown
  102. 101 ./countdown 1
  103. 102 date +%d-%m-%y
  104. 103 today=$(date +%d-%m-%)
  105. 104 echo %today
  106. 105 echo $today
  107. 106 today=$(date +%d-%m-%y)
  108. 107 echo $today
  109. 108 touch /tmp/backup-$(date +%d-%m-%y)
  110. 109 uname -r
  111. 110 cd /usr/lib/modules
  112. 111 ls
  113. 112 cd `uname -r`
  114. 113 cd ..
  115. 114 cd $(uname -r)
  116. 115 cd ..
  117. 116 cd
  118. 117 cd bash-scripting/
  119. 118 ./countdown 12
  120. 119 vim countdown
  121. 120 ./countdown 12
  122. 121 dnf install vsftpd lftp
  123. 122 systemctl start vsftpd
  124. 123 lftp localhost
  125. 124 vim /etc/vsftpd/vsftpd.conf
  126. 125 setenforce 0
  127. 126 systemctl restart vsftpd
  128. 127 lftp localhost
  129. 128 vim herescript
  130. 129 chmod +x herescript
  131. 130 ./herescript
  132. 131 vim setupftp
  133. 132 ./setupftp
  134. 133 ls
  135. 134 vim script6
  136. 135 ./script6 /usr/bin/blah
  137. 136 vim script6
  138. 137 ./script6 /usr/bin/blah
  139. 138 vim script7
  140. 139 ./script7
  141. 140 echo $(( 5 / 2 ))
  142. 141 echo $(( 5 * 2 ))
  143. 142 echo $(( 5 - 2 ))
  144. 143 echo $(( 5 % 2 ))
  145. 144 history
  146. 145 type test
  147. 146 man test
  148. 147 history
  149. 148 if [ -f /etc/hosts ]; then echo file exists; fi
  150. 149 if [ -f /etc/hoguygfuyfg ]; then echo file exists; fi
  151. 150 if true; then echo file exists; fi
  152. 151 if false; then echo file exists; fi
  153. 152 false
  154. 153 echo $?
  155. 154 true
  156. 155 echo $?
  157. 156 [ -f /etc/hosts ] && echo it exists
  158. 157 [ -f /etc/hff ] && echo it exists
  159. 158 [ -f /etc/hff ] || echo it not exists
  160. 159 [ -f /etc/hosts ] || echo it not exists
  161. 160 vim testscript
  162. 161 chmod +x testscript
  163. 162 ./testscript
  164. 163 chmod +x testscript /etc
  165. 164 chmod +x testscript /uguguiguigui
  166. 165 bash -x testscript
  167. 166 [ -x ]
  168. 167 echo $?
  169. 168 [ -x /etc ]
  170. 169 echo $?
  171. 170 [ -d /etc ]
  172. 171 echo $?
  173. 172 [ -d /ec ]
  174. 173 echo $?
  175. 174 vim testscript
  176. 175 ./testscript
  177. 176 ./testscript /etc
  178. 177 ./testscript /guguguyfguy
  179. 178 vim testscript
  180. 179 mkdir /false
  181. 180 chmod 444 /false
  182. 181 ./testscript /false
  183. 182 ls -ld /false
  184. 183 man test
  185. 184 [ -z $banana ] || echo no bananas
  186. 185 [ -z $banana ] && echo no bananas
  187. 186 ./countdown 12
  188. 187 ls
  189. 188 vim script10
  190. 189 vim greater
  191. 190 chmod +x greater
  192. 191 ./greater
  193. 192 vim greater
  194. 193 ./greater
  195. 194 vim greater
  196. 195 vim else1
  197. 196 vim else2
  198. 197 vim numcheck
  199. 198 ./numcheck
  200. 199 vim numcheck
  201. 200 strace -c ./numcheck
  202. 201 vim numcheck
  203. 202 strace -c ./numcheck
  204. 203 time ls
  205. 204 time echo *
  206. 205 ls
  207. 206 vim for
  208. 207 grep for *
  209. 208 vim lab6.sh
  210. 209 for i in *sh; do echo $i has sh extension; done
  211. 210 vim rename.sh
  212. 211 chmod +x rename.sh
  213. 212 ./rename.sh
  214. 213 mkdir spaces
  215. 214 touch one
  216. 215 touch 'one two'
  217. 216 touch three
  218. 217 ls
  219. 218 cd space
  220. 219 cd spaces
  221. 220 mv ../one* .
  222. 221 mv ../three .
  223. 222 for i in *; do echo $i; done
  224. 223 for i in *; do echo mv $i $i.bak; done
  225. 224 for i in *; do mv $i $i.bak; done
  226. 225 ls
  227. 226 touch one
  228. 227 touch three
  229. 228 rm *bak
  230. 229 for i in *; do mv "$i" "$i.bak"; done
  231. 230 ls
  232. 231 grep case *
  233. 232 cd ..
  234. 233 grep case *
  235. 234 vim script12
  236. 235 ./script12
  237. 236 vim network
  238. 237 vim convert
  239. 238 vim backout
  240. 239 history
  241.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement