-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests_bonus.txt
306 lines (306 loc) · 8.17 KB
/
tests_bonus.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
" "
""
"" | ""
''
(|)
..
|
$? * $?
$LESS$VAR
$SHLVL
'$TERM'
$TERM
$test
$test | $test
$test && echo $?
$test || echo $?
>a ls >b >>c >d
>a ls <machin >>c >d
/bin/echo bonjour
/bin/ls
/bin/ls && echo $?
/bin/ls || echo $?
/bin/ls este_ficheir_nao_existe && echo $?
/bin/ls este_ficheir_nao_existe || echo $?
/bin/pwd
>|cat
cat bla
(cat echo 5)
cat echo 5
cat file.txt | grep 'error' | wc -l
cat file.txt | tr -s ' ' '\n' | sort | uniq -c | sort -nr
cat file.txt | tr -s ' ' '\n' | sort | uniq -c | sort -nr | awk '{print $2 $1}'
cat *.h | grep struct > structs_file && echo "_STRUCT LIST:" >> structs_file && sort structs_file > sorted_structs && cat sorted_structs && rm *structs*
(cat lonely)
cat lonely
cat lonely $test*
cat lonely | clear | echo 5
cat lonely || echo $?
((cat lonely || echo $? > erro) | ls) && cat erro
cat lonely && echo $? | > test
cat lonely | (echo 5)
cat lonely|(ls)
cat lonely | ls && cat lonely | ls
cat magic
cat << magic > magic
cat Makefile | grep pr | head -n 5 | cd file_not_exit
cat Makefile | grep pr | head -n 5 | hello
cat *test
cat < test
cat test
cat test**
cat test$*
"cd .."
'cd ..'
cd ""
cd ../../../../../..
CD .
CD ..
cd $HOME/Bureau
cd $vari
cd $vari ""
cd /home/..
cd /home/dir
cd /home/user42/
cd ./path_not_found
cd ~ && pwd
cd . && pwd && cd .. && pwd && pwd && cd /bin/ls && pwd
cd random_cmd && echo $?
cd random_cmd ; echo $?
cd too many arguments
(clear)
clear | $test
clear < results
clear > results
diff test test2
echo
echo $*
echo $>?
echo $? % $?
echo $? + $?
echo $OLDPWD && cd $OLDPWD && echo $OLDPWD && cd $OLDPWD && echo $OLDPWD
echo $PATH | wc -l | grep 1 | echo $? | grep 0
echo $PWD >> test1 >> test2 > test1
(echo $test) && echo $? > test3
echo "$tests" "Makefile"
echo "$tests""Makefile"
echo "$tests"Makefile
echo $USER
echo $USER$var\$USER$USER\$USERtest$USER
echo '$USER' echo $USER
echo $var bonjour
echo "12\""
echo 2 > out1 >> out2
echo 2 >> out1 > out2
(echo 5)
echo 5
(echo 5 cat)
echo 5 cat
echo 5 | (cat)
echo\ a
echo "'abc'"
echo '"abc"'
echo "agora 'mais' fdd"
echo a"hey | ls
echo a"hey" | ls
echo a"hey"|ls
echo a"hey|ls
echo "bip | bip ><"
echo "" bonjour
echo bonjour > $test
echo bonjour && ls
echo bonjour \; ls
echo bonjour > "test 1"
echo "cat lol.c | cat > lol.c"
echo "''" | grep ""
echo "Hello && World!"
echo "Hello | World!"
echo "Hello || World!"
echo "Hello && world!" > output.txt && cat output.txt && echo "Hello world!" >> output.txt && cat output.txt
echo "Hello | world!" > output.txt && cat output.txt && echo "Hello world!" >> output.txt && cat output.txt
echo "Hello || world!" > output.txt && cat output.txt && echo "Hello world!" >> output.txt && cat output.txt
echo "hey" | ls
echo "hey" | ls
echo "hey"|ls
echo "hey|ls
echo -n
echo -n ""
(((echo -n 4) && echo 2))
((echo -n 4) && echo 2)
echo -nnm teste
echo -nnm "" | wc -l | grep 1
echo -n -nn -nnm teste
echo -nnnn teste
echo -nnn "" | wc -l | grep 0 | wc -l
echo -n -nteste
echo -n 'será"que vai dar'parsing"
echo -n "" | wc -l | grep 0 | wc -l
echo "" -n | wc -l | grep 1
echo "pedro pinto"
echo "\s" && echo "\\s"
echo "\s" ; echo "\\s"
echo test|
echo test|>
echo test|>cat
echo test|cat
echo test|cat>
echo teste
echo test > file test1
echo "This is a error \n test file. line1\nline2 error \nline3error" > file.txt
echo "" | wc -l | grep 1
env
env ""
env $vari
env > test
env > test2
exit 1 exit
exit 300 || echo $?
exit | echo $? > test
exit exit 1
exit << magic
export
export ""
export ($test)
(export $test) && export
(export $test) && export > test1 && unset test && export > test2 && diff test1 test2
export $test && export > test1 && unset test && export > test2 && diff test1 test2
export $var
export $var=test
export $var=test && export $var
export $var=test ; export $var
export 3A && echo $? && unset 3A && echo $?
export 3A && echo $? || unset 3A && echo $?
export 3A || echo $? && unset 3A || echo $?
export 3A || echo $? || unset 3A || echo $?
export "" . : , ! \\ + = - _ _a
export a127 a=
export a127 a= " "
export A2=34 A2=42 && export && export | wc -l && env | wc -l && echo $A2 && unset A2
export A2=34 && export && export | wc -l && env | wc -l && echo $A2 && unset A2
export A2=42 && export && export | wc -l && env | wc -l && echo $A2 && unset A2
export a=a b=b c=c d=d e=e && echo "$a "$b" $c $d" "$e" && unset a b c d e
export ...cookie? $OLDPWD
export cookie OLDPWD
(export (echo -n $test))
export env
export | grep cookie > test
export | grep OLDPWD >> test
export HOME= && cd
export HOME= ; cd
export loop='bonjour$loop' && echo $loop
export loop='bonjour$loop' ; echo $loop
export Nao_Existe && echo $?
export Nao_Existe || echo $?
export test=123\" && echo $test
export test=123\" ; echo $test
export test=123\\ && echo $test
export test=123\\ ; echo $test
export test=123\' && echo $test && echo $test
export test=123\' ; echo $test ; echo $test
export test1="export test2=test3" && $test1 && echo $test2
export "" test=a
export test=a && echo $test
export test=a ; echo $test
export test="env | grep OLDPWD" && $test
export test="exit" && ($test) && echo $?
(export test="exit 1123a" && ($test)) || echo $?
(export test="exit 1224" && ($test)) || echo $?
(export test="exit 1224a" && ($test)) || echo $?
export test=" foo bar " && echo $test
export test=" foo bar " ; echo $test
export test=" foo bar " && echo """$test"""
export test=" foo bar " && echo ""$test""
export test=" foo bar " && echo "$test"
export test=" foo bar " ; echo """$test"""
export test=" foo bar " ; echo ""$test""
export test=" foo bar " ; echo "$test"
export test=" foo bar " && echo "ab"$test
export test=" foo bar " && echo ab$test
export test=" foo bar " ; echo "ab"$test
export test=" foo bar " ; echo ab$test
export test=" foo bar " && echo ab"$test" | cat -e
export test=" foo bar " ; echo ab"$test" | cat -e
export "test=ici"=coucou && echo $test
export "test=ici"=coucou ; echo $test
export "" && unset ""
export var=a && export $var=test && echo $var $a
export var=a ; export $var=test ; echo $var $a
export var=at && c$var Makefile
export var=at ; c$var Makefile
export var="cat Makefile | grep >" && echo $var
export var="cat Makefile | grep >" ; echo $var
export var então export var = teste
export var= s\ -la && l$var
export var= s\ -la ; l$var
export VAR="This is a test variable." && echo $VAR && unset VAR && echo $VAR && cat output.txt
export var=" truc"&& echo $var
export var=" truc"; echo $var
export var="truc "&& echo $var | cat -e
export var="truc "; echo $var | cat -e
>file
file_name
./file_that_is_not_an_executable
find . -name "*.txt" -exec cat {} + | wc -l
find /path/to/directory -type f -size +100M -printf '%f %s\n' | exit
find . -type f | wc -l
ls *
ls bonjour && echo $?
ls bonjour ; echo $?
(ls)|cat
(ls|)cat
ls(|)cat
ls | exit
ls -l < input.txt > output.txt && cat output.txt
ls | sort
'ls | 'wc' '|' >> 1.txt'
'ls | wc | >> 1.txt'
ls | wc | >> 1.txt
<< magic wc
./minishell < exit 122 > lixo && echo $?
./minishell < exit 122 > lixo || echo $?
./minishell < exit 122 > lixo && echo $?
./minishell < exit 122 > || echo $?
./minishell < exit 50 > && echo $?
./minishell < exit 50 > || echo $?
./minishell < exit 50 > && echo $?
./minishell < exit 50 > || echo $?
./minishell < exit && > echo $?
./minishell < exit || > echo $?
./minishell < exit && > echo $?
./minishell < exit || > echo $?
./minishell < ./minishell < exit 300 && echo $?
not_cmd
not_cmd bonjour > salut
< potato cd $PWD
ps aux --sort=-%mem | head -n 10
pwd && cd . && (pwd && cd .. && pwd) && pwd && cd $OLDPWD && pwd && cd $PWD
(pwd && cd .. && pwd) && pwd && cd .
/sbin/env
/snap/bin/no_command
sort < output.txt && cat output.txt
sort -r << test > potato
sort t* > test
TERM
test|
>test|cat
test|cat
test|cat>
> test | echo blabla
> test | echo blabla; rm test
(unset $HOME) && env
unset "" . : , ! \\ + = - _ _a
unset a*
unset ...cookie? ""
unset HOME
unset / -n
unset PATH && env && echo $? && export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin" && env && echo $?
unset PATH ; ls
unset PWD
unset TERM && env && export TERM=new_term_42
unset "" test
unset test && $test
unset test && (export test="" && export > test1) && export $test > test2 && diff test1 test2
unset test && export test="" && export > test1 && export $test > test2 && diff test1 test2
unset var
/usr/local/bin/pwd
/usr/share/echo -n pinto