ajout de pleins de tests et reorganisation des fichiers

This commit is contained in:
Hugo LAMY
2021-12-21 12:21:55 +01:00
parent 85424b47c4
commit 81db47d2f4
13 changed files with 2007 additions and 875 deletions

278
tests/defaults/b_cd.sh Normal file
View File

@@ -0,0 +1,278 @@
cd
pwd
cd .
pwd
cd ~
pwd
cd /
pwd
cd no_file
pwd
cd a b c d
pwd
cd $HOME/Documents
pwd
cd ../../../../../..
pwd
cd ..
pwd
/bin/ls
cd notworking
cd .
cd ..
pwd
/bin/ls
cd ..
pwd
/bin/ls
cd notworking
cd .
cd ~
cd ../Desktop
cd
cd poep
mkdir dir
cd dir
pwd
mkdir dir
cd dir
cd .
pwd
mkdir dir
cd dir
cd ./
pwd
mkdir dir
cd dir
cd ..
pwd
mkdir dir
cd dir
cd ../
pwd
touch testfile
cd testfile
cd NO_SUCH_FILE
pwd
cd hello world
pwd
cd /
pwd
cd /
cd ../../akjwyefgjkwveyjfgweyugyuwegf76t273/../../
pwd
mkdir dir
cd dir
cd ../nosuchdir/../dir
pwd
mkdir hello
cd hello world
pwd
cd /
pwd
cd /bin
pwd
cd /bin/../
pwd
mkdir dir
cd DIR
pwd
mkdir DIR
cd dir
pwd
mkdir DIR
cd DIR
pwd
mkdir dir
chmod 000 dir
cd dir
pwd
chmod 777 dir
mkdir dir
ln -s dir link
cd link
pwd
mkdir dir
ln -s dir link
rmdir dir
cd link
pwd
mkdir dir
cd dir
cd ./
pwd
cd .
pwd
cd ./././././
pwd
cd .////////./
pwd
cd ../
pwd
mkdir dir
cd dir
rmdir ../dir
cd ./
pwd
cd .
pwd
cd ./././././
pwd
cd .////////./
pwd
cd ../
pwd
mkdir -p a/b/c
cd a/b/c
rm -rf ../../b
cd ./
pwd
cd ../
pwd
cd .////./
pwd
mkdir -p a/b/c
cd a/b/c
rm -rf ../../b
cd ./
pwd
cd .././.
pwd
cd ./
pwd
cd ../
pwd
cd
pwd
export HOME=
cd
pwd
unset HOME
cd
pwd
export HOME="./"
cd
pwd
export HOME="../../"
cd
pwd
export HOME=""
cd
pwd
export HOME="/BIN"
cd
pwd
export HOME=a
mkdir -p a/b
cd
pwd
export HOME=NO_SUCH_FILE
cd
pwd
mkdir -p a/b/c/d/e/f/g/h/i/
cd a/b/c/d/../../c/d/e/f/g/h/i/../../../g/h/i/../.././././../g/h/i/../../../../../../../c/d/../d/../d/e/../../d/e/.././././e/f/.//////../f/g/h/i/////../../../
pwd
export HOME="/"
cd
cd ../../../../../././././../../../././../../../
pwd
cd /
pwd
cd /bin
pwd
cd /
pwd
cd //bin
pwd
cd //
pwd
cd //bin
pwd
cd ///
pwd
cd ///bin
pwd
cd ////
pwd
cd ////bin
pwd
cd /////
pwd
cd /////bin
pwd
cd //////
pwd
cd //////bin
pwd
cd ///////
pwd
cd ///////bin
pwd
export HOME=//
cd
export HOME=//bin/..////////////bin/../
cd
export HOME=///
cd

118
tests/defaults/b_echo.sh Normal file
View File

@@ -0,0 +1,118 @@
echo
Echo
echo bonjour
/bin/echo bonjour
echo simple
echo -n simple
echo -n -n -nnnn -nnnnm
echo hi
echo
echo
echo
echo
echo
echo
echo working
echo
echo a
echo tab
echo " tab "
echo tab
echo hello world
echo -n
echo -n a
echo -n hello world
echo -nnnnnnnn
echo -nnnnnnnn a
echo -nnnnnnnn hello world
echo -nnnnnnnn -nnnnnnnn
echo -nnnnnnnn -nnnnnnnn a
echo -nnnnnnnn -nnnnnnnn hello world
echo -nk hello
echo -nnnnnnnnnnk hello
echo -nknknknk hello
echo hello -n
echo hello -nnnnnnn
echo hello -nknknknknk
echo hello -nnnnnnnnn -nnnnnnnnn
echo \-n hello
echo "-n" hello
echo '-n' hello
echo "-n" "hello"
echo '-n' 'hello'
echo \-\n \h\e\l\l\o
echo '\-\n' '\h\e\l\l\o'
echo "\-\n" "\h\e\l\l\o"
echo $PATH
echo "$PATH"
echo '$PATH'
echo \$PATH
echo "\$PATH"
echo '\$PATH'
echo a "" b "" c
echo a "$NO_SUCH_ENV" b $NO_SUCH_ENV c, unset NO_SUCH_ENV
echo hello
echo \"$\"
echo "$ $ $ $ $ $ "
echo "\$\$USER\\$USER""$USER"
echo $
echo \$USER
echo \\$USER
echo \\\$USER
echo \\\\$USER

367
tests/defaults/b_env.sh Normal file
View File

@@ -0,0 +1,367 @@
env
env
export BLOU=
env
unset BLOU
env
unset LOL ROR
env
unset blablabla
env
export var
export var=test
export var ="cat Makefile | grep >"
export "test=ici"=coucou
export LOL=lala ROR=rara
export "HI= hi"
export "HI =hi"
export b='\\'
export c="\b"
env
export a=hijdoehet
env
export test=working
env
export test1
env
export test1=
env
export 1test
env
export _TEST=DOethetwelmetunderscore
env
env
echo
export a=hijdoehet
echo
env
echo
export test=working
echo
env
echo
export test1
echo
env
echo
export test1=
echo
env
export ZZZ
export ZZZ=
env
export TEST="evenchecken"
echo $TEST
unset a
env
unset test
unset test1
env
unset PATH
ls
wc
awk
export PATH="test:working:multiplepath:directory1:directory2"
/usr/bin/env
export ZZZ
env
export ZZZ=
env
export ZZZ=new_value
env
export ZZZ======new
env
export ZZZ=new YYY=new2 XXX===new3
env
export $USER
env
export TEST=$USER4857987345
env
export 123$USER---
env
export MARANSIEMONS
env
export MARANSIEMONS=lief
env
export TEST=/Users/maran/Desktop/minishell
export kip=ei=koe===melk
env
export TEST1=test1 TEST2=test2
env
unset TEST1
unset TEST2
env
export TEST1=test1 TEST2=test2
unset TEST1 TEST2
env
export TEST1=test1
export TEST2=test2
unset TEST1 TEST2
env
export ""
env
unset ""
env
env | grep -v -E '^_=' | sort
cd ../
env | grep -v -E '^_=' | sort
export | grep -v -E '^declare -x _='
env
export 1 _+ _OK _2? _OK2=VAR =NG OK3=
export | grep -v -E '^declare -x _='
env
export dquote='"' dollar='$' backslash='\' backquote='`' newline='\n'
export | grep -v -E '^declare -x _='
env
export APPEND=1
export APPEND+=2
export | grep APPEND
env
export APPEND_NONE=1
export APPEND_NONE+=
export | grep APPEND_NONE
env
export APPEND_NONE=
export APPEND_NONE=
export APPEND_NONE+=
export | grep APPEND_NONE
env
export APPEND_EMPTY=""
export APPEND_EMPTY=""
export APPEND_EMPTY=""
export | grep APPEND_EMPTY
env
export OVERWRITE=42
export OVERWRITE=a
export | grep OVERWRITE
env
export A=B=C=D
export | grep A
env
export PATH
export | grep PATH
env
export PWD
export | grep PWD
env
export OLDPWD
export | grep OLDPWD
env
unset PWD
cd ..
export | grep PWD
env
unset OLDPWD
cd ..
export | grep OLDPWD
env
unset PWD
cd ..
export PWD=new_value
export | grep PWD
env
unset OLDPWD
cd ..
export OLDPWD=new_value
export | grep OLDPWD
env
unset PWD
cd ..
export PWD
export | grep PWD
env
unset OLDPWD
cd ..
export OLDPWD
export | grep OLDPWD
env
export =
env
export PATH=":"
ls , cp /bin/ls .
chmod 000 ls
export PATH=":/"
ls , cp /bin/ls .
chmod 000 ls
export PATH="::"
ls , cp /bin/ls .
chmod 000 ls
export PATH="/:"
ls , cp /bin/ls .
chmod 000 ls
export PATH="/bin:"
ls , cp /bin/ls .
chmod 000 ls
export PATH=":/bin"
ls , cp /bin/ls .
chmod 000 ls
export PATH="::/bin::"
ls , cp /bin/ls .
chmod 000 ls
export PATH="/bin:"
ls , cp /bin/ls .
chmod 000 ls
export PATH="hello:"
ls , cp /bin/ls .
chmod 000 ls
export PATH=""
nosuchfile
export PATH=''
nosuchfile
unset PATH
nosuchfile
unset PATH
export PATH
nosuchfile
unset PATH
export PATH=
nosuchfile
export PATH=":a:b"
mkdir a b
printf '#!/bin/bash\necho a' > a/cmd
printf '#!/bin/bash\necho b' > b/cmd
printf '#!/bin/bash\necho cwd' > cmd
chmod +x a/cmd b/cmd cmd
export PATH="b:a:"
mkdir a b
printf '#!/bin/bash\necho a' > a/cmd
printf '#!/bin/bash\necho b' > b/cmd
printf '#!/bin/bash\necho cwd' > cmd
chmod +x a/cmd b/cmd cmd
export PATH="a:b"
mkdir a b
printf '#!/bin/bash\necho a' > a/cmd
printf '#!/bin/bash\necho b' > b/cmd
printf '#!/bin/bash\necho cwd' > cmd
chmod +x a/cmd b/cmd cmd
export PATH="no_such_dir:a"
mkdir a
printf '#!/bin/bash\necho a' > a/cmd
printf '#!/bin/bash\necho cwd' > cmd
chmod +x a/cmd b/cmd cmd
export PATH="no_such_dir1:no_such_dir2:"
printf '#!/bin/bash\necho cwd' > cmd
chmod +x a/cmd b/cmd cmd
unset
env | grep -v -E '^_=' | sort
unset A
echo $A
export A='test $A'
unset _A1
echo $_A1
export _A1='test $_A1'
unset A B C
echo $A$B$C$D
export A=test B=multiple C=var D=hello
unset A B =invalid C
echo $A$B$C$D
export A=test B=multiple C=var D=hello
unset PWD
echo $PWD
unset OLDPWD
echo $OLDPWD
unset NO_SUCH_ENV
echo $?$NO_SUCH_ENV
unset NO_SUCH_ENV
unset 1
unset A=a
echo $A
export A=a
unset ' \"$&`\n'

69
tests/defaults/b_exit.sh Normal file
View File

@@ -0,0 +1,69 @@
exit a aa a
exit -10
exit +10
exit 123 123 123
exit 99
exit 3 a
exit 55 99
exit 0
exit 1
exit -1
exit 2147483647
exit 2147483648
exit -2147483648
exit -2147483649
exit 9223372036854775807
exit 9223372036854775808
exit -9223372036854775808
exit -9223372036854775809
exit -- 42
exit " 42 "
exit -- -- 42
exit --42
exit ++42
exit 42 42
exit a
exit 1a
exit +
exit -
exit " "
exit 0 0
exit 0 0
exit
exit 0 0
echo "this message should not be displayed" 2> file
ls
exit 0 0 | echo hello

167
tests/defaults/b_pwd.sh Normal file
View File

@@ -0,0 +1,167 @@
pwd a
pwd a b c d
pwd
pwd .
pwd ..
mkdir testt
./testt
cd ./testt
pwd
echo $OLDPWD
echo $OLDPWD
export OLDPWD=/
echo $PWD
echo $PWD
export PWD=/
echo $PWD, mkdir dir; ln -s dir symdir; cd symdir
pwd
pwd
export PWD=/
pwd
mkdir dir
ln -s dir symdir
cd symdir
pwd
echo $PWD
echo $OLDPWD
export PWD=
export OLDPWD=
mkdir dir
cd dir
pwd
echo $PWD
echo $OLDPWD
export PWD=
export OLDPWD=
mkdir dir
cd dir
cd ..
pwd
echo $PWD
echo $OLDPWD
export PWD=
export OLDPWD=
cd
pwd
echo $PWD
echo $OLDPWD
export PWD=
export OLDPWD=
mkdir dir
cd dir
rmdir ../dir
cd ./
pwd
echo $PWD
echo $OLDPWD
export PWD=
export OLDPWD=
mkdir dir
cd dir
rmdir ../dir
cd ./
cd ././././././//////////./././././././//////./
pwd
echo $PWD
echo $OLDPWD
export PWD=
export OLDPWD=
mkdir dir
cd dir
rmdir ../dir
cd ./
cd ../
pwd
echo $PWD
echo $OLDPWD
export PWD=
export OLDPWD=
mkdir dir
ln -s dir link
cd link
rmdir ../dir
cd ./
pwd
echo $PWD
echo $OLDPWD
export PWD=
export OLDPWD=
mkdir dir
ln -s dir link
cd link
rmdir ../dir
cd ./
cd ../
pwd
echo $PWD
echo $OLDPWD
export PWD=
export OLDPWD=
mkdir DIR
cd dir
rmdir ../DIR
cd ./
pwd
echo $PWD
echo $OLDPWD
export PWD=
export OLDPWD=
mkdir DIR
cd dir
rmdir ../DIR
cd ./
cd ../
pwd
echo $PWD
echo $OLDPWD
export PWD=
export OLDPWD=
mkdir dir
ln -s dir link
cd LINK
rmdir ../dir
cd ./
pwd
echo $PWD
echo $OLDPWD
export PWD=
export OLDPWD=
mkdir dir
ln -s dir link
cd LINK
rmdir ../dir
cd ./
cd ../
pwd
echo $PWD
echo $OLDPWD
export PWD=
export OLDPWD=

View File

@@ -1,106 +0,0 @@
echo
echo simple
echo -n simple
echo -n -n -nnnn -nnnnm
pwd a
pwd a b c d
cd
pwd
cd .
pwd
cd ~
pwd
cd /
pwd
cd no_file
pwd
cd a b c d
pwd
cd $HOME/Documents
pwd
cd ../../../../../..
pwd
exit -10
exit +10
echo bonjour
/bin/echo bonjour
mkdir testt
./testt
cd ./testt
pwd
exit a aa a
pwd
Echo
exit 123 123 123
echo hi
echo
echo
echo
echo
echo
echo
echo working
echo
cd ..
pwd
/bin/ls
cd notworking
cd .
cd ..
pwd
/bin/ls
cd ..
pwd
/bin/ls
cd notworking
cd .
cd ~
pwd
pwd .
pwd ..
cd ../Desktop
echo
cd
cd poep
exit 99
exit 3 a
exit 55 99

View File

@@ -1,148 +0,0 @@
env
env
export BLOU=
env
unset BLOU
env
unset LOL ROR
env
unset blablabla
env
export var
export var=test
export var ="cat Makefile | grep >"
export "test=ici"=coucou
export LOL=lala ROR=rara
export "HI= hi"
export "HI =hi"
export b='\\'
export c="\b"
env
export a=hijdoehet
env
export test=working
env
export test1
env
export test1=
env
export 1test
env
export _TEST=DOethetwelmetunderscore
env
env
echo
export a=hijdoehet
echo
env
echo
export test=working
echo
env
echo
export test1
echo
env
echo
export test1=
echo
env
export ZZZ
export ZZZ=
env
export TEST="evenchecken"
echo $TEST
unset a
env
unset test
unset test1
env
unset PATH
ls
wc
awk
export PATH="test:working:multiplepath:directory1:directory2"
/usr/bin/env
export ZZZ
env
export ZZZ=
env
export ZZZ=new_value
env
export ZZZ======new
env
export ZZZ=new YYY=new2 XXX===new3
env
export $USER
env
export TEST=$USER4857987345
env
export 123$USER---
env
export MARANSIEMONS
env
export MARANSIEMONS=lief
env
export TEST=/Users/maran/Desktop/minishell
export kip=ei=koe===melk
env
export TEST1=test1 TEST2=test2
env
unset TEST1
unset TEST2
env
export TEST1=test1 TEST2=test2
unset TEST1 TEST2
env
export TEST1=test1
export TEST2=test2
unset TEST1 TEST2
env
export ""
env
unset ""
env

View File

@@ -65,3 +65,92 @@ $'
hallo\hoi
\hallo
\hallo
/bin/ls
touch a
a
/bin/ls -a
touch a
a
/bin/ls | /usr/bin/grep a
touch aa ab ac
/bin/ls | /usr/bin/grep a | /usr/bin/grep c
touch aa ab ac
ls
touch a
a
ls -a
touch a
a
ls | grep a
touch aa ab ac
ls | grep a | grep c
touch aa ab ac
echo hello world | cat
no_such_file
./no_such_file
/bin/ls/no_such_file
/bin/no_such_dir/file
perm
touch perm
chmod 000 perm
./perm
touch perm
chmod 000 perm
perm
touch perm
chmod 100 perm
./perm
touch perm
chmod 100 perm
perm
touch perm
chmod 300 perm
./perm
touch perm
chmod 300 perm
perm
touch perm
chmod 500 perm
./perm
touch perm
chmod 500 perm
./empty
touch empty
chmod +x empty
dir
mkdir dir
./dir
mkdir dir
./exe
printf "#!/bin/bash\necho 42" > exe
chmod +x exe
ln -s exe sym
chmod -h -x sym
echo a | $NO_ENV | cat
unset NO_ENV

View File

@@ -12,502 +12,312 @@ echo '1"$not_a_variable"2'
export VARIABLE1="variable1"
echo '1"$VARIABLE1"2'
echo '\'
echo $
echo '\\'
echo $+
echo "\n \n \n"
mkdir directory1
export POEP=directory1
cd $POEP $MEERPOEP ..
pwd
echo hi";" hihi
mkdir directory1
mkdir directory1/directory2
export POEP=directory1
export MEERPOEP=directory2
cd $POEP $MEERPOEP ..
pwd
echo hi " ; " hihi
export vat=at
c$var Makefile
echo "\s"
$blablabla
echo "ls -la <a | grep x > b"
$LESS$VAR
echo ok "" ok
echo "$HOME"
echo ok "" "" "" "" "" "" "" "" "" ok
echo '$HOME'
echo "exit"
echo "hallo$"
echo "exit\n"
hallo$
cat < ../
export ECHO="echo"
$ECHO "hello"
echo ";;;;;"
export A=p
export B=w
$A"$B"d
"$A"'$B'd
echo “./hello”.
export A="s -la"
l$A
echo ./hello
export OK="ok ok"
echo $OK
echo ello
$
echo ' \n this is the; "first line"'
echo $POEP hallo
echo "and right here;;; 'We have the second'"
echo $/
echo and" a fe"'w 'here'; with some slash and quotes .' '\'
echo $
echo '\\'
echo $PWD
echo "\poep"
export LS="ls -la"
$LS
echo"
echo $PWD
"
echo $HOME
export a="\\"
echo "$PWD"
export b='\\'
echo '$PWD'
export c="\b"
echo "$HOME"
echo > ilovewords.txt count me
wc ilovewords.txt
cd $IETSONBESTAANDS
awk '{ print }' /etc/passwd
cd $GEK ..
echo 'how are you'
cd $NOTHING $MORENOTHING ..
"echo" hallo daar
echo "hallo daar"
echo '$PWD'
"ls"
echo $USER""
hallo ma\ran siemons Hij ziet de \ niet als escape, print gewoon \
echo $USER_
echo 'ma\'
echo 123$USER----
echo "\poep"
echo 123$USER----$
echo hallo""
echo abc$USERdef
123"456
echo abc$USER123
123"456""
echo abc$POEPdef
echo "\poep"
echo $USER "$USER" '$USER'
echo 'poep''poep2'"maran"'ellende'END
export TEST_$USER=hallo$LOGNAME
echo poeppoep2maranellendeEND
echo $POEP
echo 'poep2'"maran"'ellende'
echo $POEP $MEERPOEP
echo poep2maranellende
echo hallo $POEP
echo hallo
echo $POEP hallo
echo echt bash
IETSONBESTAANDS=".."
cd $IETSONBESTAANDS
cd $IETSONBESTAANDS
echo halloUSER
cd $IETSONBESTAANDS
cd $IETSONBESTAANDS
pwd
echo halloPOEP
echo 'hallo$USER'
echo halloUSER
echo hallo$USER
echo "\hallo"
echo 'hallo\$USER'
echo "123\!456"
echo '\$?'
echo "1234"
echo '$USER'
echo "12\34"
echo '\$USER'
echo "1\a234"
echo '"\$USER"'
echo "\1234"
echo "hoi$USERmaran"
echo '1234\\'
echo "$USER"
echo '1234'
export TWO=" two "
echo "one "$TWO" three"
echo "one"$TWO" three"
echo "one"$TWO"three"
echo "one" $TWO "three"
echo '12\34'
export TWO="two"
echo "one"$TWO"three"
echo "one "$TWO"three"
echo "one "$TWO" three"
echo '1234\'
echo "one"$TWO"three"
echo '1\a234'
echo "one "$TWO"three"
echo '\1234'
echo "one "$TWO" three"
echo '1234\\'
echo "one" $TWO "three"
echo '1234\\'
echo "hallo$"
echo "\!"
echo hallo$
echo "\#"
echo '$USER'$USER
echo "\%"
echo $USERmaran
echo "\&"
echo hallo"1234"maran"$USER"'/$USER'"/$USER"'poep''poep2'"maran"'ellende'END
echo "\'"
echo hallo1234maranmaran/$USER/maranpoeppoep2maranellendeEND
echo "\("
echo "$USER"'/$USER'
echo "\)"
echo maran/$USER
echo "\*"
echo 123"hallo$"456
echo "\+"
echo $_1234
echo "\,"
echo $USERhallo
echo "\-"
echo $hallo"poep"
echo "\."
echo $a5aap
echo "\/"
echo $_poep
echo "\0"
echo hallo$abc
echo "\1"
echo $halllo###
echo "\2"
echo $USER9582309582529
echo "\3"
echo $
echo "\4"
echo $USER
echo "\5"
echo '$USER'
echo "\6"
echo "$USER"
echo "\7"
echo 123$USER----
echo "\8"
echo 123$USER----$
echo "\9"
echo abc$USERdef
echo "\:"
echo abc$USER123
echo "\<"
echo abc$POEPdef
echo "\="
echo $%%%%jlkjtwejt
echo "\>"
echo %%$
echo "\?"
echo "$_poep"
echo "\@"
echo "$a5aap"
echo "\A"
echo "$halllo###"
echo "\B"
echo "$USER9582309582529"
echo "\C"
echo "$"
echo "\D"
echo hallo"$"abc
echo "\E"
echo hallo"$POEP"abc
echo "\F"
echo hallo"$USER"abc
echo "\G"
echo "$USER"
echo "\H"
echo "$USER'"
echo "\I"
echo "$USER_"
echo "\J"
echo "abc$USERdef"
echo "\K"
echo "abc$USER123"
echo "\L"
echo "abc$POEPdef"
echo "\M"
echo "$%%%%jlkjtwejt"
echo "\N"
echo "%%$"
echo "\O"
echo $hallo
echo "\P"
echo $hallo"poep"
echo "\Q"
echo "hallo$USER"
echo "\R"
echo "hallo$USER"
echo "\S"
echo hallo$abc
echo "\T"
echo hallo$abc
echo "\U"
echo $rewtwet
echo "\V"
echo '\$'
echo "\W"
echo "\X"
export HELLO=hello; echo $HELLO
echo "\Y"
export HELLO=hello; echo $hello
echo "\Z"
echo $
echo "\["
echo "$"
echo "\]"
echo '$'
echo "\^"
echo \$
echo "\_"
echo "\$"
echo "\a"
export HELLO=hello
echo \$HELLO
echo "\b"
export HELLO=hello
echo \\$HELLO
echo "\c"
export HELLO=hello
echo "$HELLO"
echo "\d"
export HELLO=hello
echo "\$HELLO"
echo "\e"
export HELLO=hello
echo "\\$HELLO"
echo "\f"
export HELLO=hello
echo \\"$HELLO"
echo "\g"
export HELLO=hello
echo "\"\"$HELLO"
echo "\h"
export TEST=ech
"$TEST"o hello
echo "\i"
export TEST="echo hello"
$TEST
echo "\j"
export TEST='echo hello'
$TEST
echo "\k"
export TEST="\$\"echo hello\""
$TEST
echo "\l"
export TEST="echo hello"
export TEST2="\$TEST"
$TEST2
echo "\m"
export abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890=hello
echo $abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890
echo "\n"
echo "\o"
echo "\p"
echo "\q"
echo "\r"
echo "\s"
echo "\t"
echo "\u"
echo "\v"
echo "\w"
echo "\x"
echo "\y"
echo "\z"
echo "\{"
echo "\|"
echo "\}"
echo "\~"
echo '\!'
echo '\"'
echo '\#'
echo '\%'
echo '\&'
#echo '\''
echo '\('
echo '\)'
echo '\*'
echo '\+'
echo '\,'
echo '\-'
echo '\.'
echo '\/'
echo '\0'
echo '\1'
echo '\2'
echo '\3'
echo '\4'
echo '\5'
echo '\6'
echo '\7'
echo '\8'
echo '\9'
echo '\:'
echo '\<'
echo '\='
echo '\>'
echo '\?'
echo '\@'
echo '\A'
echo '\B'
echo '\C'
echo '\D'
echo '\E'
echo '\F'
echo '\G'
echo '\H'
echo '\I'
echo '\J'
echo '\K'
echo '\L'
echo '\M'
echo '\N'
echo '\O'
echo '\P'
echo '\Q'
echo '\R'
echo '\S'
echo '\T'
echo '\U'
echo '\V'
echo '\W'
echo '\X'
echo '\Y'
echo '\Z'
echo '\['
echo '\\'
echo '\]'
echo '\^'
echo '\_'
echo '\a'
echo '\b'
echo '\c'
echo '\d'
echo '\e'
echo '\f'
echo '\g'
echo '\h'
echo '\i'
echo '\j'
echo '\k'
echo '\l'
echo '\m'
echo '\n'
echo '\o'
echo '\p'
echo '\q'
echo '\r'
echo '\s'
echo '\t'
echo '\u'
echo '\v'
echo '\w'
echo '\x'
echo '\y'
echo '\z'
echo '\{'
echo '\|'
echo '\}'
echo '\~'
echo '\;'
echo "\;"
echo '\>'
echo "\>"
echo '\<'
echo "\<"
echo '\|'
echo "\|"
export TEST="export TEST=echo"
$TEST hello
$TEST hello

View File

@@ -1,255 +0,0 @@
# ERROR :
# OK :
echo $
echo $+
mkdir directory1
export POEP=directory1
cd $POEP $MEERPOEP ..
pwd
mkdir directory1
mkdir directory1/directory2
export POEP=directory1
export MEERPOEP=directory2
cd $POEP $MEERPOEP ..
pwd
export vat=at
c$var Makefile
$blablabla
$LESS$VAR
echo "$HOME"
echo '$HOME'
echo "hallo$"
hallo$
export ECHO="echo"
$ECHO "hello"
export A=p
export B=w
$A"$B"d
"$A"'$B'd
export A="s -la"
l$A
export OK="ok ok"
echo $OK
$
echo $POEP hallo
echo $/
echo $
echo $PWD
export LS="ls -la"
$LS
echo $PWD
echo $HOME
echo "$PWD"
echo '$PWD'
echo "$HOME"
cd $IETSONBESTAANDS
cd $GEK ..
cd $NOTHING $MORENOTHING ..
echo '$PWD'
echo $USER""
echo $USER_
echo 123$USER----
echo 123$USER----$
echo abc$USERdef
echo abc$USER123
echo abc$POEPdef
echo $USER "$USER" '$USER'
export TEST_$USER=hallo$LOGNAME
echo $POEP
echo $POEP $MEERPOEP
echo hallo $POEP
echo $POEP hallo
IETSONBESTAANDS=".."
cd $IETSONBESTAANDS
cd $IETSONBESTAANDS
cd $IETSONBESTAANDS
cd $IETSONBESTAANDS
pwd
echo 'hallo$USER'
echo hallo$USER
echo 'hallo\$USER'
echo '\$?'
echo '$USER'
echo '\$USER'
echo '"\$USER"'
echo "hoi$USERmaran"
echo "$USER"
export TWO=" two "
echo "one "$TWO" three"
echo "one"$TWO" three"
echo "one"$TWO"three"
echo "one" $TWO "three"
export TWO="two"
echo "one"$TWO"three"
echo "one "$TWO"three"
echo "one "$TWO" three"
echo "one"$TWO"three"
echo "one "$TWO"three"
echo "one "$TWO" three"
echo "one" $TWO "three"
echo "hallo$"
echo hallo$
echo '$USER'$USER
echo $USERmaran
echo hallo"1234"maran"$USER"'/$USER'"/$USER"'poep''poep2'"maran"'ellende'END
echo hallo1234maranmaran/$USER/maranpoeppoep2maranellendeEND
echo "$USER"'/$USER'
echo maran/$USER
echo 123"hallo$"456
echo $_1234
echo $USERhallo
echo $hallo"poep"
echo $a5aap
echo $_poep
echo hallo$abc
echo $halllo###
echo $USER9582309582529
echo $
echo $USER
echo '$USER'
echo "$USER"
echo 123$USER----
echo 123$USER----$
echo abc$USERdef
echo abc$USER123
echo abc$POEPdef
echo $%%%%jlkjtwejt
echo %%$
echo "$_poep"
echo "$a5aap"
echo "$halllo###"
echo "$USER9582309582529"
echo "$"
echo hallo"$"abc
echo hallo"$POEP"abc
echo hallo"$USER"abc
echo "$USER"
echo "$USER'"
echo "$USER_"
echo "abc$USERdef"
echo "abc$USER123"
echo "abc$POEPdef"
echo "$%%%%jlkjtwejt"
echo "%%$"
echo $hallo
echo $hallo"poep"
echo "hallo$USER"
echo "hallo$USER"
echo hallo$abc
echo hallo$abc
echo$rewtwet
echo '\$'

499
tests/defaults/quotes.sh Normal file
View File

@@ -0,0 +1,499 @@
echo '\'
echo '\\'
echo "\n \n \n"
echo hi";" hihi
echo hi " ; " hihi
echo "\s"
echo "ls -la <a | grep x > b"
echo ok "" ok
echo ok "" "" "" "" "" "" "" "" "" ok
echo "exit"
echo "exit\n"
cat < ../
echo ";;;;;"
echo “./hello”.
echo ./hello
echo ello
echo ' \n this is the; "first line"'
echo "and right here;;; 'We have the second'"
echo and" a fe"'w 'here'; with some slash and quotes .' '\'
echo '\\'
echo "\poep"
echo"
"
export a="\\"
export b='\\'
export c="\b"
echo > ilovewords.txt count me
wc ilovewords.txt
awk '{ print }' /etc/passwd
echo 'how are you'
"echo" hallo daar
echo "hallo daar"
"ls"
hallo ma\ran siemons Hij ziet de \ niet als escape, print gewoon \
echo 'ma\'
echo "\poep"
echo hallo""
123"456
123"456""
echo "\poep"
echo 'poep''poep2'"maran"'ellende'END
echo poeppoep2maranellendeEND
echo 'poep2'"maran"'ellende'
echo poep2maranellende
echo hallo
echo echt bash
echo halloUSER
echo halloPOEP
echo halloUSER
echo "\hallo"
echo "123\!456"
echo "1234"
echo "12\34"
echo "1\a234"
echo "\1234"
echo '1234\\'
echo '1234'
echo '12\34'
echo '1234\'
echo '1\a234'
echo '\1234'
echo '1234\\'
echo '1234\\'
echo "\!"
echo "\#"
echo "\%"
echo "\&"
echo "\'"
echo "\("
echo "\)"
echo "\*"
echo "\+"
echo "\,"
echo "\-"
echo "\."
echo "\/"
echo "\0"
echo "\1"
echo "\2"
echo "\3"
echo "\4"
echo "\5"
echo "\6"
echo "\7"
echo "\8"
echo "\9"
echo "\:"
echo "\<"
echo "\="
echo "\>"
echo "\?"
echo "\@"
echo "\A"
echo "\B"
echo "\C"
echo "\D"
echo "\E"
echo "\F"
echo "\G"
echo "\H"
echo "\I"
echo "\J"
echo "\K"
echo "\L"
echo "\M"
echo "\N"
echo "\O"
echo "\P"
echo "\Q"
echo "\R"
echo "\S"
echo "\T"
echo "\U"
echo "\V"
echo "\W"
echo "\X"
echo "\Y"
echo "\Z"
echo "\["
echo "\]"
echo "\^"
echo "\_"
echo "\a"
echo "\b"
echo "\c"
echo "\d"
echo "\e"
echo "\f"
echo "\g"
echo "\h"
echo "\i"
echo "\j"
echo "\k"
echo "\l"
echo "\m"
echo "\n"
echo "\o"
echo "\p"
echo "\q"
echo "\r"
echo "\s"
echo "\t"
echo "\u"
echo "\v"
echo "\w"
echo "\x"
echo "\y"
echo "\z"
echo "\{"
echo "\|"
echo "\}"
echo "\~"
echo '\!'
echo '\"'
echo '\#'
echo '\%'
echo '\&'
#echo '\''
echo '\('
echo '\)'
echo '\*'
echo '\+'
echo '\,'
echo '\-'
echo '\.'
echo '\/'
echo '\0'
echo '\1'
echo '\2'
echo '\3'
echo '\4'
echo '\5'
echo '\6'
echo '\7'
echo '\8'
echo '\9'
echo '\:'
echo '\<'
echo '\='
echo '\>'
echo '\?'
echo '\@'
echo '\A'
echo '\B'
echo '\C'
echo '\D'
echo '\E'
echo '\F'
echo '\G'
echo '\H'
echo '\I'
echo '\J'
echo '\K'
echo '\L'
echo '\M'
echo '\N'
echo '\O'
echo '\P'
echo '\Q'
echo '\R'
echo '\S'
echo '\T'
echo '\U'
echo '\V'
echo '\W'
echo '\X'
echo '\Y'
echo '\Z'
echo '\['
echo '\\'
echo '\]'
echo '\^'
echo '\_'
echo '\a'
echo '\b'
echo '\c'
echo '\d'
echo '\e'
echo '\f'
echo '\g'
echo '\h'
echo '\i'
echo '\j'
echo '\k'
echo '\l'
echo '\m'
echo '\n'
echo '\o'
echo '\p'
echo '\q'
echo '\r'
echo '\s'
echo '\t'
echo '\u'
echo '\v'
echo '\w'
echo '\x'
echo '\y'
echo '\z'
echo '\{'
echo '\|'
echo '\}'
echo '\~'
echo '\;'
echo "\;"
echo '\>'
echo "\>"
echo '\<'
echo "\<"
echo '\|'
echo "\|"

View File

@@ -163,3 +163,69 @@ cat file1 file2
echo DOET HET NIET > test1
echo hallo >x1 >x2 >x3
> file
> file | cat < no_such_file
echo hello > out1.txt > out2.txt > out3.txt 2> err1.txt 2> err2.txt 2> err3.txt; cat out1.txt out2.txt out3.txt err1.txt err2.txt err3.txt
echo hello >> out1.txt >> out2.txt >> out3.txt 2>> err1.txt 2>> err2.txt 2>> err3.txt; cat out1.txt out2.txt out3.txt err1.txt err2.txt err3.txt
ls > out1.txt > out2.txt > out3.txt 2> err1.txt 2> err2.txt 2> err3.txt; cat out1.txt out2.txt out3.txt err1.txt err2.txt err3.txt
ls >> out1.txt >> out2.txt >> out3.txt 2>> err1.txt 2>> err2.txt 2>> err3.txt; cat out1.txt out2.txt out3.txt err1.txt err2.txt err3.txt
ls no_such_file > out1.txt > out2.txt > out3.txt 2> err1.txt 2> err2.txt 2> err3.txt; cat out1.txt out2.txt out3.txt err1.txt err2.txt err3.txt
ls no_such_file >> out1.txt >> out2.txt >> out3.txt 2>> err1.txt 2>> err2.txt 2>> err3.txt; cat out1.txt out2.txt out3.txt err1.txt err2.txt err3.txt
echo a > out
echo b >> out
echo c >> out
echo d >> out
cat out
echo a > out
echo b >> out
echo c >> out
echo d > out
cat out
echo hello 2147483647> file
echo hello 2147483648> file
echo a > $NO_ENV | echo b
unset NO_ENV
./a.out 3> file3 2> file2 1> file1
cat file3 file2 file1
printf '#include<unistd.h>\nint main(){write(1, "fd1\\n", 4);write(2, "fd2\\n", 4);write(3, "fd3\\n", 4);}' > a.c && gcc a.c
./a.out 1> file1 2> file2 3> file3
cat file1 file2 file3
printf '#include<unistd.h>\nint main(){write(1, "fd1\\n", 4);write(2, "fd2\\n", 4);write(3, "fd3\\n", 4);}' > a.c && gcc a.c
echo a 1> 1.txt 2> 2.txt 3> 3.txt
./a.out 1>> 1.txt 2>> 2.txt 3>> 3.txt
cat 1.txt 2.txt 3.txt
printf '#include<unistd.h>\nint main(){write(1, "fd1\\n", 4);write(2, "fd2\\n", 4);write(3, "fd3\\n", 4);}' > a.c && gcc a.c
echo a 3> 3.txt 2> 2.txt 1> 1.txt 2> 2.txt 3> 3.txt
echo b 1>> 1.txt 2>> 2.txt 3>> 3.txt 2>> 2.txt 1>> 1.txt
./a.out 1>> 1.txt 2>> 2.txt 3>> 3.txt 2>> 2.txt 1>> 1.txt
cat 1.txt 2.txt 3.txt
printf '#include<unistd.h>\nint main(){write(1, "fd1\\n", 4);write(2, "fd2\\n", 4);write(3, "fd3\\n", 4);}' > a.c && gcc a.c
echo a > f
echo b >> f
cat f f f >> ff
cat ff ff >> f
cat f
ls>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f>f
cat f
ls>a>b>c>d>e>f>g>h>i>j>k>l>m>n>o>p>q>r>s>t>u>v>w>x>y>z>A>B>C>D>E>F>G>H>I>J>K>L>M>N>O>P>Q>R>S>T>U>V>W>X>Y>Z>aa>ab>ac>ad>ae>af>ag>ah>ai>aj>ak>al>am>an>ao>ap>aq>ar>as>at>au>av>aw>ax>ay>az>aA>aB>aC>aD>aE>aF>aG>aH>aI>aJ>aK>aL>aM>aN>aO>aP>aQ>aR>aS>aT>aU>aV
ls

View File

@@ -54,6 +54,184 @@ export PATH="test:working:multiplepath:directory1:directory2"
env
#----------------------------------------------
# CD builtins
export CDPATH="/"
cd bin
pwd
export CDPATH="/"
cd
pwd
export CDPATH="/"
export HOME=
cd
pwd
export CDPATH="/"
unset HOME
cd
pwd
export CDPATH=""
mkdir -p a/b
cd b
pwd
export CDPATH="./"
mkdir dir
cd dir
pwd
export CDPATH="../a"
mkdir -p a/b/c
cd b
pwd
cd a
pwd
cd b
pwd
export CDPATH=a
mkdir -p a/b/c
cd b
pwd
export CDPATH=A
mkdir -p a/b/c
cd b
pwd
export CDPATH=a
mkdir -p a/b/c
cd ./b
pwd
export CDPATH=a
mkdir -p a/b/c
cd a
cd ../b
pwd
export CDPATH=a
mkdir -p a/b/c
cd .
pwd
export CDPATH=a
mkdir -p a/b/c
cd a
cd ..
pwd
export CDPATH=a
mkdir -p a/b/c
mkdir b
cd b
pwd
export CDPATH=a/b
mkdir -p a/b/c
cd c
pwd
export CDPATH=a:b:a:b
mkdir -p a/test b/test
mkdir -p a:b/test
cd test
pwd
export CDPATH=b:a:a:b
mkdir -p a/test b/test
mkdir -p a:b/test
cd test
pwd
export CDPATH=a:b:a:b
mkdir -p a/hello b/hello
mkdir -p a:b/test
cd test
pwd
export CDPATH=a:b:a:b
mkdir -p a/test b/test
mkdir -p a:b/test
chmod 000 a/test
cd test
pwd
cd ../../
chmod 777 a/test
export CDPATH="/"
cd /
pwd
export CDPATH="/"
cd /bin
pwd
export CDPATH="/bin"
cd /bin
pwd
export CDPATH="/bin"
cd /bin
pwd
export CDPATH="a"
mkdir a
cd a
pwd
export CDPATH="a"
mkdir -p a/a
cd a
pwd
export CDPATH=//
cd bin
export CDPATH=//bin/..////////////bin/../
cd bin
export CDPATH=///
cd bin
export CDPATH=":"
cd dir
pwd
export CDPATH="hello:"
cd dir
pwd
export CDPATH=":/"
cd dir
pwd
export CDPATH="::/"
cd bin
pwd
export CDPATH="::/:"
cd bin
pwd
export CDPATH=""
cd bin
pwd
export CDPATH="/:"
cd bin
pwd
export CDPATH="//::"
cd bin
pwd
#----------------------------------------------
# special characters