Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ######## SUBSHELLS
- student@student-virtual-machine:~/bash-scripting$ cat colors
- COLOR=red
- student@student-virtual-machine:~/bash-scripting$ cat use-colors.sh
- #!/bin/bash
- echo the color is $COLOR
- student@student-virtual-machine:~/bash-scripting$ chmod +x use-colors.sh
- student@student-virtual-machine:~/bash-scripting$ ./use-colors.sh
- the color is
- student@student-virtual-machine:~/bash-scripting$ COLOR=yellow
- student@student-virtual-machine:~/bash-scripting$ ./use-colors.sh
- the color is
- student@student-virtual-machine:~/bash-scripting$ export COLOR=yellow
- student@student-virtual-machine:~/bash-scripting$ ./use-colors.sh
- the color is yellow
- student@student-virtual-machine:~/bash-scripting$ vim use-colors.sh
- student@student-virtual-machine:~/bash-scripting$ vim use-colors.sh
- student@student-virtual-machine:~/bash-scripting$ cat use-colors.sh
- #!/bin/bash
- . colors
- echo the color is $COLOR
- student@student-virtual-machine:~/bash-scripting$ ./use-colors.sh
- the color is red
- ##########
- student@student-virtual-machine:~/bash-scripting$ cat je.sh
- #!/bin/bash
- [ ! -d ~/sysconfig ] && mkdir ~/sysconfig
- echo PLANET=moon > ~/sysconfig/planets
- . ~/sysconfig/planets
- echo Your current planet is $PLANET
- ##########student@student-virtual-machine:~/bash-scripting$ echo $?
- 6
- student@student-virtual-machine:~/bash-scripting$ cat script8c
- #!/bin/bash
- if [ ! -f /etc/hostss ]
- then
- echo criticial error
- exit 6
- fi
- echo file does exist
- ########
- #!/bin/bash
- sudo useradd $1
- #echo useradd $1
- if [ $? -eq 0 ]
- then
- echo user created successfully
- else
- echo user not created successfully
- fi
- exit 0
- #########
- student@student-virtual-machine:~/bash-scripting$ cat mz.sh
- #!/bin/bash
- sudo useradd $1
- #echo useradd $1
- if [ $? -eq 0 ]
- then
- echo user created successfully
- else
- echo user not created successfully
- fi
- exit 0
- student@student-virtual-machine:~/bash-scripting$ cat ts.sh
- #!/bin/bash
- # This is the comment
- if sudo useradd $1
- then
- echo "User created successfully"
- else
- echo "User not created successfully"
- fi
- exit 0
- ###########
- student@student-virtual-machine:~/bash-scripting$ history
- 1 ls
- 2 echo $BASH
- 3 sudo apt install vim git bash-completion
- 4 git clone https://github.com/sandervanvugt/bash-script
- 5 git clone https://github.com/sandervanvugt/bash-scripting
- 6 cd bash-scripting/
- 7 ls
- 8 chsh --help
- 9 history
- 10 ls
- 11 vim script1
- 12 ls /etc/hosts
- 13 echo $?
- 14 ls hweriughiuh
- 15 echo $?
- 16 vim script1
- 17 script1
- 18 echo $PATH
- 19 pwd
- 20 ls
- 21 ./script1
- 22 ls -l
- 23 chmod +x script1
- 24 ./script1
- 25 history
- 26 ./countdown 3
- 27 vim script2
- 28 cat script2
- 29 ./script2
- 30 ls -l
- 31 chmod +x scr*
- 32 ls -l
- 33 cat script2
- 34 ./script2
- 35 vim subshell.txt
- 36 vim colors
- 37 vim use-colors.sh
- 38 cat colors
- 39 cat use-colors.sh
- 40 chmod +x use-colors.sh
- 41 ./use-colors.sh
- 42 COLOR=yellow
- 43 ./use-colors.sh
- 44 export COLOR=yellow
- 45 ./use-colors.sh
- 46 vim use-colors.sh
- 47 cat use-colors.sh
- 48 ./use-colors.sh
- 49 vim use-colors.sh
- 50 ./countdown 13
- 51 vim je.sh
- 52 chmod +x je.sh
- 53 ./je.sh
- 54 chmod +x je.sh
- 55 vim je.sh
- 56 ./je.sh
- 57 vim je.sh
- 58 ./je.sh
- 59 vim je.sh
- 60 man test
- 61 vim je.sh
- 62 ./je.sh
- 63 vim je.sh
- 64 ./je.sh
- 65 cat je.sh
- 66 history
- 67 vim countdown
- 68 vim script3
- 69 echo $(( 2 * 30 ))
- 70 echo $( 2 * 30 )
- 71 vim script3
- 72 ./script3 a b c d e f g h i jk l m n o p
- 73 cat script3
- 74 echo $$$$$
- 75 echo \$$$$$
- 76 echo '$$$$$'
- 77 blah lisa
- 78 ./countdown 3
- 79 vim je.sh
- 80 vim je2.sh
- 81 chmod +x je2.sh
- 82 ./je2.sh
- 83 ./je2.sh linda lucy lori
- 84 vim je2.sh
- 85 vim script4
- 86 ./script4 a b c d e
- 87 cat script4
- 88 vim script4
- 89 ./script4 a b c d e
- 90 touch iwrhgi
- 91 ./countdown 3
- 92 vim kc.sh
- 93 ip a
- 94 chmod +x kc.sh
- 95 ./kc.sh 8 1 7 6 5
- 96 vim kc.sh
- 97 cd /lib
- 98 ls
- 99 cd kernel/
- 100 ls
- 101 cd ..
- 102 cd
- 103 uname -r
- 104 find / -name $(uname -r)
- 105 sudo find / -name $(uname -r) 2>/dev/null
- 106 cd /usr/lib/modules
- 107 ls
- 108 cd $(uname -r)
- 109 cd ..
- 110 cd `uname -r`
- 111 cd
- 112 cd bash-scripting/
- 113 ./countdown 3
- 114 vim dv.sh
- 115 bash dv.sh
- 116 ls
- 117 vim script6
- 118 ./script6 /usr/bin/blah
- 119 vim script6
- 120 ./script6 /usr/bin/blah
- 121 vim script6
- 122 ./script6 /usr/bin/blah
- 123 vim script6
- 124 vim script7
- 125 ./countdown 4
- 126 ls
- 127 vim je2.sh
- 128 vim je3.sh
- 129 chmod +x je3.sh
- 130 ./je3.sh
- 131 vim je3.sh
- 132 vim script8
- 133 cat /etc/passwd
- 134 cut -d : -f 1 /etc/passwd
- 135 vim script8
- 136 sudo useradd alex
- 137 sudo useradd alexander
- 138 ./script8 alex
- 139 ./script8 khkuhi
- 140 vim script8
- 141 cp script8 script8b
- 142 vim script8b
- 143 chmod +x script8b
- 144 ./script8b alex
- 145 ./script8b erblhjki
- 146 vim script8b
- 147 vim script8c
- 148 chmod +x script8c
- 149 ./script8c
- 150 vim script8c
- 151 ./script8c
- 152 echo $?
- 153 cat script8c
- 154 vim users
- 155 grep alex users
- 156 grep ^alex users
- 157 grep alex$ users
- 158 grep ^alex$ users
- 159 vim script8
- 160 vim script8c
- 161 man test
- 162 test -f /etc/hosts
- 163 echo $0
- 164 test -f /etc/hosts
- 165 echo $?
- 166 test ! -f /etc/hosts
- 167 echo $?
- 168 [ ! -f /etc/hosts ]
- 169 echo $?
- 170 less /etc/network/if-post-down.d/wireless-tools
- 171 vim script8
- 172 ./script8 alex
- 173 vim script8
- 174 ./countdown 12
- 175 vim mz.sh
- 176 chmod +x mz.sh
- 177 ./mz.sh
- 178 ./mz.sh bob
- 179 vim mz.sh
- 180 ./mz.sh
- 181 bash -x mz.sh
- 182 vim mz.sh
- 183 man test
- 184 vim mz.sh
- 185 ./mz.sh
- 186 vim mz.sh
- 187 ./mz.sh
- 188 vim mz.sh
- 189 ./mz.sh bill
- 190 cat mz.sh
- 191 vim script9
- 192 cp script9 script9b
- 193 vim script9b
- 194 chmod +x script9b
- 195 ./script9b
- 196 echo $?
- 197 ./script9b jhyki
- 198 vim script9b
- 199 [ -f /etc/khkiu ] || echo failing
- 200 [ -f /etc/hosts ] || echo failing
- 201 [ -f /etc/hosts ] && echo successfull
- 202 [ -f /etc/hosthjgjgys ] && echo successfull
- 203 ./countdown 3
- 204 vim ts.sh
- 205 chmod +x ts.sh
- 206 ./ts.sh
- 207 ./ts.sh bob
- 208 ./ts.sh ben
- 209 history
- 210 cat mz.sh
- 211 cat ts.sh
- 212 vim sb.sh
- 213 man test
- 214 vim sb.sh
- 215 chmod +x sb.sh
- 216 ./sb.sh
- 217 vim sb.sh
- 218 ./sb.sh
- 219 vim sb.sh
- 220 ./sb.sh
- 221 ls -l /etc/shadow
- 222 ls
- 223 vim script10
- 224 ./script10 5
- 225 vim script11
- 226 ./script11 1
- 227 vim script11
- 228 ./script11 1
- 229 vim script11
- 230 ./script11 1
- 231 bash -x script11 1
- 232 vim script11
- 233 ./script11 1
- 234 bash -x ./script11 1
- 235 ls
- 236 vim script11
- 237 ./script11 1
- 238 vim script11
- 239 ./script11 1
- 240 vim script11
- 241 ./script11 1
- 242 history
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement