ajout option log et ignore comments in tests
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
|
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2021/10/04 05:59:26 by lperrey #+# #+# */
|
/* Created: 2021/10/04 05:59:26 by lperrey #+# #+# */
|
||||||
/* Updated: 2021/12/02 17:11:55 by hulamy ### ########.fr */
|
/* Updated: 2021/12/03 07:06:35 by hulamy ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -23,8 +23,8 @@ void shell_loop(t_all *c)
|
|||||||
{
|
{
|
||||||
if (line_input)
|
if (line_input)
|
||||||
free(line_input);
|
free(line_input);
|
||||||
// write(2, c->prompt, ft_strlen(c->prompt));
|
write(2, c->prompt, ft_strlen(c->prompt));
|
||||||
// rl_already_prompted = 1;
|
rl_already_prompted = 1;
|
||||||
// line_input = read_input(NULL, c);
|
// line_input = read_input(NULL, c);
|
||||||
line_input = read_input(c->prompt, c);
|
line_input = read_input(c->prompt, c);
|
||||||
if (line_input && *line_input)
|
if (line_input && *line_input)
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
[1;32mhulamy@NoName[0m:[1;34m/home/simplonco/Nextcloud/informatique/42/minishell/minishell/tests
|
[1;37mmybash a very long prompt to test the output in case of a redirection in a file> [0mecho hello
|
||||||
s/unit_tests[0m> echo test
|
hello
|
||||||
test
|
[1;37mmybash a very long prompt to test the output in case of a redirection in a file> [0mexit
|
||||||
|
|||||||
7
tests/unit_tests/logs/bash_log.txt
Normal file
7
tests/unit_tests/logs/bash_log.txt
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
[01;32msimplonco@simplonco-Latitude-E6320[00m:[01;34m~/Nextcloud/informatique/42/minishell/minishell/tests/unit_tests[00m$ echo hello
|
||||||
|
hello
|
||||||
|
[01;32msimplonco@simplonco-Latitude-E6320[00m:[01;34m~/Nextcloud/informatique/42/minishell/minishell/tests/unit_tests[00m$ exit
|
||||||
|
[01;32msimplonco@simplonco-Latitude-E6320[00m:[01;34m~/Nextcloud/informatique/42/minishell/minishell/tests/unit_tests[00m$ echo you
|
||||||
|
you
|
||||||
|
[01;32msimplonco@simplonco-Latitude-E6320[00m:[01;34m~/Nextcloud/informatique/42/minishell/minishell/tests/unit_tests[00m$ exit
|
||||||
7
tests/unit_tests/logs/minishell_log.txt
Normal file
7
tests/unit_tests/logs/minishell_log.txt
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
[1;32mhulamy@NoName[0m:[1;34m/home/simplonco/Nextcloud/informatique/42/minishell/minishell/tests
|
||||||
|
s/unit_tests[0m> echo hello
|
||||||
|
hello
|
||||||
|
[1;32mhulamy@NoName[0m:[1;34m/home/simplonco/Nextcloud/informatique/42/minishell/minishell/tests
|
||||||
|
s/unit_tests[0m> exit
|
||||||
|
[1;32mhulamy@NoName[0m:[1;34m/home/simplonco/Nextcloud/informatique/42/minishell/minishell/tests
|
||||||
43
tests/unit_tests/main.c
Normal file
43
tests/unit_tests/main.c
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
#include <unistd.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <readline/readline.h>
|
||||||
|
|
||||||
|
#define WHITE "\001\e[1;37m\002"
|
||||||
|
#define RESET "\001\e[0m\002"
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
char *prompt;
|
||||||
|
char *line_input;
|
||||||
|
|
||||||
|
//prompt = WHITE"mybash a very long prompt to test the output in case of a redirection in a file> "RESET;
|
||||||
|
prompt = WHITE"mybash> "RESET;
|
||||||
|
line_input = NULL;
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
if (line_input)
|
||||||
|
free(line_input);
|
||||||
|
line_input = readline(prompt);
|
||||||
|
if (line_input)
|
||||||
|
{
|
||||||
|
if (!strncmp(line_input, "echo ", 5))
|
||||||
|
{
|
||||||
|
write(1, line_input + 5, strlen(line_input) - 5);
|
||||||
|
write(1, "\n", 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!line_input)
|
||||||
|
{
|
||||||
|
write(2, "exit\n", 5);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
prompt = WHITE"mybash a very long prompt to test the output in case of a redirection in a file, style longer than that even> "RESET;
|
||||||
|
write(1, prompt, strlen(prompt));
|
||||||
|
write(1, "\n", 1);
|
||||||
|
*/
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
105
tests/unit_tests/t0mm4rx_tests.md
Normal file
105
tests/unit_tests/t0mm4rx_tests.md
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
# Minishell tests
|
||||||
|
|
||||||
|
Here are some tests for the minishell project of school 42 cursus. It's not exaustive, so don't limit yourself with this tests.
|
||||||
|
These tests are not all mines. Credits to vgoldman, mashar, and jecaudal.
|
||||||
|
|
||||||
|
tmarx
|
||||||
|
# Tests
|
||||||
|
|
||||||
|
- [ ] echo bonjour ; |
|
||||||
|
- [ ] echo bonjour | |
|
||||||
|
- [ ] |
|
||||||
|
- [ ] echo bonjour |;
|
||||||
|
- [ ] echo bonjour \; ls
|
||||||
|
- [ ] echo bonjour > test\ 1
|
||||||
|
- [ ] cd $HOME/Documents
|
||||||
|
- [ ] echo "\s" & echo "\\s"
|
||||||
|
- [ ] echo \>
|
||||||
|
- [ ] echo -n -n -nnnn -nnnnm
|
||||||
|
- [ ] cat /dev/random | head -n 1 | cat -e
|
||||||
|
- [ ] unset var1 # with undefined var1
|
||||||
|
- [ ] export "" et unset ""
|
||||||
|
- [ ] echo test > file test1
|
||||||
|
- [ ] $
|
||||||
|
- [ ] not_cmd bonjour > salut
|
||||||
|
- [ ] env puis export puis env # vars aren't sorted
|
||||||
|
- [ ] cat Makefile | grep pr | head -n 5 | cd test (mybin) # check status code
|
||||||
|
- [ ] cat Makefile | grep pr | head -n 5 | cat test (bin) # check status code
|
||||||
|
- [ ] cat Makefile | grep pr | head -n 5 | hello (NA) # check status code
|
||||||
|
- [ ] echo bonjour >>> test
|
||||||
|
- [ ] echo bonjour > > out
|
||||||
|
- [ ] echo 2 >> out1 > out2
|
||||||
|
- [ ] echo 2 > out1 >> out2
|
||||||
|
- [ ] cat < test # with non-existent test
|
||||||
|
- [ ] export var; export var=test
|
||||||
|
- [ ] echo bonjour > $test # with test not defined
|
||||||
|
- [ ] file_name_in_current_dir
|
||||||
|
- [ ] cd ../../../../../.. ; pwd
|
||||||
|
- [ ] ctrl-C . 130 sur bin(ex : sleep 10)&line vide
|
||||||
|
- [ ] ctrl-\ .131 sur bin
|
||||||
|
- [ ] echo "bip | bip ; coyotte > < \" "
|
||||||
|
- [ ] cat | cat | cat | ls # check outputs order
|
||||||
|
- [ ] $bla # with bla not defined
|
||||||
|
- [ ] export var ="cat Makefile | grep >"
|
||||||
|
- [ ] export "test=ici"=coucou
|
||||||
|
- [ ] c$var Makefile # with var=at
|
||||||
|
- [ ] $LESS$VAR
|
||||||
|
- [ ] /bin/echo bonjour
|
||||||
|
- [ ] not_cmd
|
||||||
|
- [ ] sleep 5 | exit
|
||||||
|
- [ ] echo bonjour > $test w/ t
|
||||||
|
- [ ] "exit retour a la ligne"
|
||||||
|
- [ ] minishell # binary not in path without "./" before
|
||||||
|
- [ ] cat diufosgid # check exit code
|
||||||
|
- [ ] exit # should return the last exit code value
|
||||||
|
- [ ] exit -10
|
||||||
|
- [ ] exit +10
|
||||||
|
- [ ] ;
|
||||||
|
- [ ] echo coucou | ;
|
||||||
|
- [ ] echo "$HOME"
|
||||||
|
- [ ] echo '$HOME'
|
||||||
|
- [ ] export ; env # display is different for both commands
|
||||||
|
- [ ] echo \$HOME
|
||||||
|
- [ ] > log echo coucou
|
||||||
|
- [ ] echo hudifg d | | hugdfihd
|
||||||
|
- [ ] echo
|
||||||
|
- [ ] echo simple
|
||||||
|
- [ ] echo -n simple
|
||||||
|
- [ ] echo '\'
|
||||||
|
- [ ] echo "\"
|
||||||
|
- [ ] echo "\\"
|
||||||
|
- [ ] echo "\n \n \n"
|
||||||
|
- [ ] echo "\n \\n \\\n"
|
||||||
|
- [ ] echo ;;
|
||||||
|
- [ ] echo hi";" hihi
|
||||||
|
- [ ] echo hi " ; " hihi
|
||||||
|
- [ ] cd
|
||||||
|
- [ ] cd .
|
||||||
|
- [ ] cd ~
|
||||||
|
- [ ] cd /
|
||||||
|
- [ ] cd no_file
|
||||||
|
- [ ] cd a b c d
|
||||||
|
- [ ] pwd a
|
||||||
|
- [ ] pwd a b c d
|
||||||
|
- [ ] export LOL=lala ROR=rara
|
||||||
|
- [ ] unset LOL ROR
|
||||||
|
- [ ] export "HI= hi"
|
||||||
|
- [ ] export "HI =hi"
|
||||||
|
- [ ] /bin/ls
|
||||||
|
- [ ] # write something the press ctrl+c
|
||||||
|
- [ ] # write something then press ctrl+d
|
||||||
|
- [ ] # write something then press ctrl+\
|
||||||
|
- [ ] echo $?
|
||||||
|
- [ ] l^Ds
|
||||||
|
- [ ] echo |
|
||||||
|
- [ ] | echo
|
||||||
|
- [ ] sort | ls # check output order
|
||||||
|
- [ ] cat < >
|
||||||
|
- [ ] cat < <
|
||||||
|
- [ ] cat > >
|
||||||
|
- [ ] > a ls > b < Makefile
|
||||||
|
- [ ] echo > a Hello World!
|
||||||
|
- [ ] > a echo Hello World!
|
||||||
|
- [ ] cat < Makefile | grep gcc > output
|
||||||
|
- [ ] exit 0 | exit 1
|
||||||
|
- [ ] exit 1 | exit 0
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
echo hello
|
echo hello
|
||||||
|
|
||||||
|
# comment
|
||||||
|
|
||||||
echo you
|
echo you
|
||||||
|
|
||||||
echo "how are"
|
|
||||||
|
|
||||||
echo "you ?"
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
## if not found, launch test on default file list
|
## if not found, launch test on default file list
|
||||||
## 2. execute the main for-loop
|
## 2. execute the main for-loop
|
||||||
## it will iterate through the commands of each files
|
## it will iterate through the commands of each files
|
||||||
|
## if a line start with a # it's skipped
|
||||||
## if commands are not separated by empty line, it concat them
|
## if commands are not separated by empty line, it concat them
|
||||||
## then it calls the compare function "test_minishell" with commands
|
## then it calls the compare function "test_minishell" with commands
|
||||||
## and it calls the print function with the results
|
## and it calls the print function with the results
|
||||||
@@ -38,23 +39,86 @@
|
|||||||
ENDCO="\001\e[0m\002"
|
ENDCO="\001\e[0m\002"
|
||||||
|
|
||||||
# copy the executable to current directory
|
# copy the executable to current directory
|
||||||
|
rm -rf ./minishell
|
||||||
cp ../../minishell .
|
cp ../../minishell .
|
||||||
|
|
||||||
# list of tests files, by default ot in parameters
|
# globale variables
|
||||||
if [ $# == 0 ]
|
UNIT_TEST=0
|
||||||
then
|
SUCCESS_TEST=0
|
||||||
list_files="
|
TOTAL_TEST=0
|
||||||
|
TOTAL_SUCCESS=0
|
||||||
|
LOG=0
|
||||||
|
mkdir -p ./logs
|
||||||
|
echo "" > ./logs/bash_log.txt
|
||||||
|
echo "" > ./logs/minishell_log.txt
|
||||||
|
BASH_LOG="./logs/bash_log.txt"
|
||||||
|
MINISHELL_LOG="./logs/minishell_log.txt"
|
||||||
|
|
||||||
|
# default list of files to be use
|
||||||
|
default_files="\
|
||||||
vrac.sh
|
vrac.sh
|
||||||
pipes.sh
|
pipes.sh
|
||||||
expensions.sh
|
expensions.sh
|
||||||
redirections.sh
|
redirections.sh
|
||||||
heredocs.sh
|
|
||||||
exit_status.sh
|
exit_status.sh
|
||||||
builtins.sh
|
builtins.sh"
|
||||||
"
|
#heredocs.sh
|
||||||
|
|
||||||
|
# print usage
|
||||||
|
function print_usage
|
||||||
|
{
|
||||||
|
echo -en "$GREEN"
|
||||||
|
echo " usage :"
|
||||||
|
echo -en "$ENDCO"
|
||||||
|
echo -en "$CYAN"
|
||||||
|
echo " > bash test_unit.sh [options] [list files...]"
|
||||||
|
echo -en "$ENDCO"
|
||||||
|
echo ""
|
||||||
|
echo -en "$GREEN"
|
||||||
|
echo " if no files are given in parameters, the defaults will be used"
|
||||||
|
echo " defaults files :"
|
||||||
|
echo -en "$ENDCO"
|
||||||
|
echo -en "$CYAN"
|
||||||
|
echo "$default_files"
|
||||||
|
echo -en "$ENDCO"
|
||||||
|
echo ""
|
||||||
|
echo -en "$GREEN"
|
||||||
|
echo " options :"
|
||||||
|
echo -en "$ENDCO"
|
||||||
|
echo -en "$CYAN"
|
||||||
|
echo " help - print usage"
|
||||||
|
echo " log - log output into logs/<logs_files.txt>"
|
||||||
|
echo -en "$ENDCO"
|
||||||
|
echo ""
|
||||||
|
echo -en "$GREEN"
|
||||||
|
echo " tests files are formated with the following rules :"
|
||||||
|
echo -en "$ENDCO"
|
||||||
|
echo -en "$CYAN"
|
||||||
|
echo " - a line starting with # is skipped"
|
||||||
|
echo " - an empty line separate two sets of commands"
|
||||||
|
echo " - other lines are commands"
|
||||||
|
echo " - multiples lines in a row are executed as following commands"
|
||||||
|
echo -en "$ENDCO"
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
|
# list of tests files, by default ot in parameters
|
||||||
|
if [ $# == 0 ]
|
||||||
|
then
|
||||||
|
list_files="$default_files"
|
||||||
else
|
else
|
||||||
|
if [ "$1" == "help" ]
|
||||||
|
then
|
||||||
|
print_usage
|
||||||
|
else
|
||||||
|
START=1
|
||||||
|
if [ "$1" == "log" ]
|
||||||
|
then
|
||||||
|
LOG=1
|
||||||
|
START=2
|
||||||
|
fi
|
||||||
list_files=""
|
list_files=""
|
||||||
for (( i = 1 ; i <= "$#" ; i++ ))
|
for (( i = $START ; i <= "$#" ; i++ ))
|
||||||
do
|
do
|
||||||
if [ -e "${!i}" ]
|
if [ -e "${!i}" ]
|
||||||
then
|
then
|
||||||
@@ -68,12 +132,7 @@
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
# globale variables
|
|
||||||
UNIT_TEST=0
|
|
||||||
SUCCESS_TEST=0
|
|
||||||
TOTAL_TEST=0
|
|
||||||
TOTAL_SUCCESS=0
|
|
||||||
|
|
||||||
# function that will launch the command in bash and minishell and compare them
|
# function that will launch the command in bash and minishell and compare them
|
||||||
function test_minishell
|
function test_minishell
|
||||||
@@ -81,6 +140,12 @@
|
|||||||
# execute commands in bash and minishell
|
# execute commands in bash and minishell
|
||||||
bash_execution=$( echo "$@" | bash 2>/dev/null )
|
bash_execution=$( echo "$@" | bash 2>/dev/null )
|
||||||
minishell_execution=$( echo "$@" | ./minishell 2>/dev/null )
|
minishell_execution=$( echo "$@" | ./minishell 2>/dev/null )
|
||||||
|
# if log options, log results
|
||||||
|
if [ "$LOG" == 1 ]
|
||||||
|
then
|
||||||
|
echo "$@" | bash -i &>>$BASH_LOG
|
||||||
|
echo "$@" | ./minishell &>>$MINISHELL_LOG
|
||||||
|
fi
|
||||||
#compare output
|
#compare output
|
||||||
if [ "$bash_execution" = "$minishell_execution" ]
|
if [ "$bash_execution" = "$minishell_execution" ]
|
||||||
then
|
then
|
||||||
@@ -117,6 +182,7 @@
|
|||||||
|
|
||||||
# the main loop: go through the files and call the compare func on each commands
|
# the main loop: go through the files and call the compare func on each commands
|
||||||
# parse tests files line by line, grouping lines non-separated by an empty line
|
# parse tests files line by line, grouping lines non-separated by an empty line
|
||||||
|
# if line start with # it's ignore
|
||||||
for i in $list_files
|
for i in $list_files
|
||||||
do
|
do
|
||||||
filename=$i
|
filename=$i
|
||||||
@@ -127,7 +193,10 @@
|
|||||||
SUCCESS_TEST=0
|
SUCCESS_TEST=0
|
||||||
while read line
|
while read line
|
||||||
do
|
do
|
||||||
if [ "$line" != "" ]
|
if [ -n "$line" ]
|
||||||
|
then
|
||||||
|
# if line start with # skip it
|
||||||
|
if [ "${line:0:1}" != "#" ]
|
||||||
then
|
then
|
||||||
if [ "$command_test" == "" ]
|
if [ "$command_test" == "" ]
|
||||||
then
|
then
|
||||||
@@ -142,7 +211,8 @@
|
|||||||
(( TOTAL_TEST++ ))
|
(( TOTAL_TEST++ ))
|
||||||
test_minishell "$command_test"
|
test_minishell "$command_test"
|
||||||
fi
|
fi
|
||||||
elif [ "$command_test" != "" ]
|
fi
|
||||||
|
elif [ -z "$line" ] && [ -n "$command_test" ]
|
||||||
then
|
then
|
||||||
(( UNIT_TEST++ ))
|
(( UNIT_TEST++ ))
|
||||||
(( TOTAL_TEST++ ))
|
(( TOTAL_TEST++ ))
|
||||||
|
|||||||
56
tests/unit_tests/tests_discord.md
Normal file
56
tests/unit_tests/tests_discord.md
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
rotrojan (Romain) — 06/10/2021
|
||||||
|
si tu veux on m'a passé quelques listes de tests sympas ... 😈
|
||||||
|
|
||||||
|
fd leaks:
|
||||||
|
```
|
||||||
|
ulimit -n # nombre de fd dispo max (pour expliquer le principe de fd leaks a l'evalué)
|
||||||
|
ls /proc/self/fd # affiche le nombre fd utilisés par le process enfant il faut donc repeter cette commande plusieurs fois lors de la correction pour verifier les fd leaks
|
||||||
|
ls | ls | ls /proc/self/fd # regarder le nombre de fd
|
||||||
|
ls | ls | ls | ls | ls | ls /proc/self/fd # le nombre de fd doit etre le meme que la ligne d'avant!
|
||||||
|
# essayer aussi avec des redirections!
|
||||||
|
```
|
||||||
|
trivialités:
|
||||||
|
```
|
||||||
|
#lancer minishell comme ceci puis faire des bails
|
||||||
|
env -i ./minishell
|
||||||
|
|
||||||
|
# redirections:
|
||||||
|
>test # doit creer test
|
||||||
|
>>test # doit creer test
|
||||||
|
<test # doit essayer d'ouvrir test
|
||||||
|
cat <a <b >c >d # input b output d
|
||||||
|
# pipes
|
||||||
|
ls | cat # affiche ls
|
||||||
|
cat | ls # doit afficher ls puis doit exit apres un \n
|
||||||
|
# les redirections doivent etre faites APRES les pipes, (donc sont prioritaires par ecrasement)
|
||||||
|
cat a | < b cat | cat > c | cat # b doit etre copié dans c, rien ne doit etre ecrit dans stdout
|
||||||
|
# execution
|
||||||
|
./non_executable # permission denied exit code 126
|
||||||
|
./directory
|
||||||
|
non_executable # avec non_executable dans un dossier du path, permission denied
|
||||||
|
cat < directory
|
||||||
|
```
|
||||||
|
parsing :
|
||||||
|
```
|
||||||
|
export A="s -la" #puis faire
|
||||||
|
l$A #doit executer un ls -la (donc que le split se fait apres le remplacement de var d'env)
|
||||||
|
|
||||||
|
export A=p #puis faire
|
||||||
|
export B=w #puis faire
|
||||||
|
$A"$B"d #doit executer un pwd, puis faire
|
||||||
|
"$A"'$B'd #ne doit pas faire de pwd car les var d'env ne sont pas remplacee dans les simple quote
|
||||||
|
|
||||||
|
echo "ls -la <a | grep x > b" #doit afficher "ls -la <a | grep x > b"
|
||||||
|
echo ok "" ok #doit avoir deux espaces car "" est un argument vide mais est un argument
|
||||||
|
echo ok "" "" "" "" "" "" "" "" "" ok #pour mieux voir ce qui est avant
|
||||||
|
|
||||||
|
export OK="ok ok" #puis faire
|
||||||
|
echo $OK #doit afficher "ok ok" (un seul espace entre les deux, echo prends deux arguments)
|
||||||
|
|
||||||
|
# si il y a le ; qui est fait
|
||||||
|
unset A #pour etre sur que la variable d'environnement existe pas puis faire la suite sur une autre ligne de commande
|
||||||
|
export A=ok; echo $A #doit afficher un ok
|
||||||
|
```
|
||||||
|
https://github.com/t0mm4rx/minishell_tests
|
||||||
|
|
||||||
|
@dkoriaki (Daniel) plusieurs de ces tests ne sont plus pertinents car ils concernaient l'ancien sujet de minishell, mais la plupart restent quand même intéressants
|
||||||
@@ -1 +1,199 @@
|
|||||||
echo "vrac"
|
echo bonjour ; |
|
||||||
|
|
||||||
|
echo bonjour | |
|
||||||
|
|
||||||
|
|
|
||||||
|
|
||||||
|
echo bonjour |;
|
||||||
|
|
||||||
|
echo bonjour \; ls
|
||||||
|
|
||||||
|
echo bonjour > test\ 1
|
||||||
|
|
||||||
|
cd $HOME/Documents
|
||||||
|
|
||||||
|
echo "\s" & echo "\\s"
|
||||||
|
|
||||||
|
echo \>
|
||||||
|
|
||||||
|
echo -n -n -nnnn -nnnnm
|
||||||
|
|
||||||
|
cat /dev/random | head -n 1 | cat -e
|
||||||
|
|
||||||
|
unset blablabla
|
||||||
|
|
||||||
|
export "" et unset ""
|
||||||
|
|
||||||
|
echo test > file test1
|
||||||
|
|
||||||
|
$
|
||||||
|
|
||||||
|
not_cmd bonjour > salut
|
||||||
|
|
||||||
|
env
|
||||||
|
export
|
||||||
|
env
|
||||||
|
|
||||||
|
cat Makefile | grep pr | head -n 5 | cd test (mybin)
|
||||||
|
$?
|
||||||
|
|
||||||
|
cat Makefile | grep pr | head -n 5 | cat test (bin)
|
||||||
|
$?
|
||||||
|
|
||||||
|
cat Makefile | grep pr | head -n 5 | hello (NA)
|
||||||
|
$?
|
||||||
|
|
||||||
|
echo bonjour >>> test
|
||||||
|
|
||||||
|
echo bonjour > > out
|
||||||
|
|
||||||
|
echo 2 >> out1 > out2
|
||||||
|
|
||||||
|
echo 2 > out1 >> out2
|
||||||
|
|
||||||
|
cat < blablabla
|
||||||
|
|
||||||
|
export var; export var=test
|
||||||
|
|
||||||
|
echo bonjour > $test
|
||||||
|
|
||||||
|
file_name_in_current_dir
|
||||||
|
|
||||||
|
cd ../../../../../.. ; pwd
|
||||||
|
|
||||||
|
ctrl-C . 130 sur bin(ex : sleep 10)&line vide
|
||||||
|
|
||||||
|
ctrl-\ .131 sur bin
|
||||||
|
|
||||||
|
echo "bip | bip ; coyotte > < \" "
|
||||||
|
|
||||||
|
cat | cat | cat | ls
|
||||||
|
|
||||||
|
$blablabla
|
||||||
|
|
||||||
|
export var ="cat Makefile | grep >"
|
||||||
|
|
||||||
|
export "test=ici"=coucou
|
||||||
|
|
||||||
|
export vat=at
|
||||||
|
c$var Makefile
|
||||||
|
|
||||||
|
$LESS$VAR
|
||||||
|
|
||||||
|
/bin/echo bonjour
|
||||||
|
|
||||||
|
not_cmd
|
||||||
|
|
||||||
|
sleep 5 | exit
|
||||||
|
|
||||||
|
echo bonjour > $test w/ t
|
||||||
|
|
||||||
|
"exit retour a la ligne"
|
||||||
|
|
||||||
|
minishell
|
||||||
|
# binary not in path without "./" before
|
||||||
|
|
||||||
|
cat diufosgid
|
||||||
|
$?
|
||||||
|
|
||||||
|
exit
|
||||||
|
$?
|
||||||
|
|
||||||
|
exit -10
|
||||||
|
|
||||||
|
exit +10
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
echo coucou | ;
|
||||||
|
|
||||||
|
echo "$HOME"
|
||||||
|
|
||||||
|
echo '$HOME'
|
||||||
|
|
||||||
|
export ; env # display is different for both commands
|
||||||
|
|
||||||
|
echo \$HOME
|
||||||
|
|
||||||
|
> log echo coucou
|
||||||
|
|
||||||
|
echo hudifg d | | hugdfihd
|
||||||
|
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo simple
|
||||||
|
|
||||||
|
echo -n simple
|
||||||
|
|
||||||
|
echo '\'
|
||||||
|
|
||||||
|
echo "\"
|
||||||
|
|
||||||
|
echo "\\"
|
||||||
|
|
||||||
|
echo "\n \n \n"
|
||||||
|
|
||||||
|
echo "\n \\n \\\n"
|
||||||
|
|
||||||
|
echo ;;
|
||||||
|
|
||||||
|
echo hi";" hihi
|
||||||
|
|
||||||
|
echo hi " ; " hihi
|
||||||
|
|
||||||
|
cd
|
||||||
|
|
||||||
|
cd .
|
||||||
|
|
||||||
|
cd ~
|
||||||
|
|
||||||
|
cd /
|
||||||
|
|
||||||
|
cd no_file
|
||||||
|
|
||||||
|
cd a b c d
|
||||||
|
|
||||||
|
pwd a
|
||||||
|
|
||||||
|
pwd a b c d
|
||||||
|
|
||||||
|
export LOL=lala ROR=rara
|
||||||
|
|
||||||
|
unset LOL ROR
|
||||||
|
|
||||||
|
export "HI= hi"
|
||||||
|
|
||||||
|
export "HI =hi"
|
||||||
|
|
||||||
|
/bin/ls
|
||||||
|
write something the press ctrl+c
|
||||||
|
write something then press ctrl+d
|
||||||
|
write something then press ctrl+\
|
||||||
|
|
||||||
|
echo $?
|
||||||
|
|
||||||
|
l^Ds
|
||||||
|
|
||||||
|
echo |
|
||||||
|
|
||||||
|
| echo
|
||||||
|
|
||||||
|
sort | ls
|
||||||
|
|
||||||
|
cat < >
|
||||||
|
|
||||||
|
cat < <
|
||||||
|
|
||||||
|
cat > >
|
||||||
|
|
||||||
|
> a ls > b < Makefile
|
||||||
|
|
||||||
|
echo > a Hello World!
|
||||||
|
|
||||||
|
> a echo Hello World!
|
||||||
|
|
||||||
|
cat < Makefile | grep gcc > output
|
||||||
|
|
||||||
|
exit 0 | exit 1
|
||||||
|
|
||||||
|
exit 1 | exit 0
|
||||||
|
|||||||
Reference in New Issue
Block a user