qq modifs pour pull

This commit is contained in:
hugogogo
2021-12-17 11:56:46 +01:00
parent 3c89304cda
commit a2ea274c9f
3 changed files with 36 additions and 29 deletions

View File

@@ -1,16 +1,39 @@
1. redirection et quotes expansion 1. redirection & quotes expansion
``` ```
bash> echo "hello" > "file" bash$ echo "hello" > "file"
bash> ls bash$ ls
file file
bash> bash$
``` ```
``` ```
minishell> echo "hello" > "file" minishell$ echo "hello" > "file"
minishell> ls minishell$ ls
'"file"' '"file"'
minishell> minishell$
``` ```
2. 2. redirection & open
`prompt$ > newfile`
create file `newfile` in bash, but not in minishell
3. redirection & open
ok `prompt$ echo "hello" > $not_a_variable`
ok does'nt create a file in bash, but does in minishell
4. redirection & variables expansion
```
export NEWVAR="newfile"
echo hello > $NEWVAR
```
create file "newfile" in bash, but a file named "'$NEWVAR'" in minishell
5. redireciton & pipes
`ls | < not_a_file cat`
gives an error about "not_a_file" and stop in bash, but in minishell it continues forever
(`< not_a_file cat` works fine in both bash and minishell)

View File

@@ -1,10 +1,8 @@
echo bonjour > $test echo bonjour > $test
ls ls
rm '$test'
> log echo coucou > log echo coucou
ls ls
rm log
cat < > cat < >
@@ -14,63 +12,48 @@ cat > >
> a ls > b < Makefile > a ls > b < Makefile
ls ls
rm a b
echo > a Hello World! echo > a Hello World!
ls ls
rm a
> a echo Hello World! > a echo Hello World!
ls ls
rm a
echo bonjour > test\ 1 echo bonjour > test\ 1
ls ls
rm test
echo bonjour >>> test echo bonjour >>> test
echo bonjour > > out echo bonjour > > out
ls ls
rm out
echo 2 >> out1 > out2 echo 2 >> out1 > out2
ls ls
rm out1 out2
echo 2 > out1 >> out2 echo 2 > out1 >> out2
ls ls
rm out1 out2
cat < blablabla cat < blablabla
echo test > file test1 echo test > file test1
ls ls
rm file
not_cmd bonjour > salut not_cmd bonjour > salut
ls ls
rm salut
>testt >testt
ls ls
rm testt
>>testt >>testt
ls ls
rm testt
<testt <testt
ls ls
rm testt
touch testt touch testt
<testt <testt
rm testt
rm testt
<testt <testt
rm testt
cat <a <b >c >d cat <a <b >c >d
@@ -81,12 +64,10 @@ cat a
cat b cat b
cat c cat c
cat d cat d
rm a b c d
cat a | < b cat | cat > c | cat cat a | < b cat | cat > c | cat
ls ls
rm a b c
echo hello >a echo hello >a
echo byebye >b echo byebye >b
@@ -96,11 +77,14 @@ ls
cat a cat a
cat b cat b
cat c cat c
rm a b c
echo bonjour > $test w/ t echo bonjour > $test w/ t
ls ls
export TEST=newfile
echo hello > $TEST
ls
echo > "hardesttest.txt" echo > "hardesttest.txt"
echo adding stuff >> working.txt echo adding stuff >> working.txt

View File

@@ -143,7 +143,7 @@ cd $(dirname $0)
function test_minishell function test_minishell
{ {
# execute commands in bash, and logs results # execute commands in bash, and logs results
bash_execution=$( echo "$@" | bash 2>/dev/null ) bash_execution=$( echo "$@" | bash -i 2>/dev/null )
delete_files delete_files
minishell_execution=$( echo "$@" | ./minishell 2>/dev/null ) minishell_execution=$( echo "$@" | ./minishell 2>/dev/null )
delete_files delete_files