mochida1 / minishell

Mudar a descrição depois
5 stars 1 forks source link

minishell

Mudar a descrição depois

nota de compilação

utilizar -lreadline como em `gcc -Wall -Wextra -Werror nomearquivo.c -lreadline -o nomebinario

Glossário:

Gnu Bash manual: 2 - Definitions

metacharacters

pior caso

<./infile.txt cmd1 'arg"' "arg'" 'apenas'"1"'arg'|cmd2 "arg||" "$var" '$notvar'>~/dir/outfile

pontos de atenção

testes para regras de parsing

> diff "tfile1"'tfile2'
< diff: missing operand after 'tfile1tfile2'
> MEUECHO="cat tfile1 > outfile"
> MEUECHO
< 111111111111111111
< cat: '>': No such file or directory
> echo teste | cat readline.c >>> teste
< syntax error near unexpected token `>'

regras para categorização de tokens

testes

O readline sempre vaza still reachable: 204,580 bytes in 215 blockspor padrão. template

not echo echonot echo$

echo echo echo echo test001 echo test001 echo test 001 echo $ echo $PWD echo $test000 echo test000 $PWD echo "test000 $PWD" echo 'test000 $PWD' echo test000 "$PWD" echo test000 '$PWD' echo test000 $var_que_nao_existe echo "test000 $var_que_nao_existe" echo 'test000 $var_que_nao_existe' echo test000 "$var_que_nao_existe" echo test000 '$var_que_nao_existe' echo test000$PWD echo "test000$PWD" echo 'test000$PWD' echo test000"$PWD" echo test000'$PWD' echo "test000"$PWD echo 'test000'$PWD echo test000$var_que_nao_existe echo "test000$var_que_nao_existe" echo 'test000$var_que_nao_existe' echo 'test000'$var_que_nao_existe echo "test000"$var_que_nao_existe echo test000'$var_que_nao_existe' echo test000"$var_que_nao_existe" echo exit ./a.out init' 1 2 '" 3 4 "parseme ./a.out a' 1 2 3 '" 4 5 6 "b

exit exits with 0; exit 1 exits with 1; exit a exit bash: exit: a: numeric argument required exits with 2; exit a b c d e f exit bash: exit: a: numeric argument required exits with 2; exit 1 2 3 4 5 6 exit bash: exit: too many arguments RETURNS 1, does not exit; exit 1 a b c d e exit bash: exit: too many arguments RETURNS 1, does not exit; exit a 1 2 3 4 5 exit bash: exit: a: numeric argument required exits with 2; exit 2147483647 exits with 255; exit 2147483648 exits with 0; exit 2147483649 exits with 1;

<< EOF < INFILE cdm arg1 arg2 >> APP > OW | < in << eof cdm arg3 arg4 > ow >> app

echo with option -n ◦ cd with only a relative or absolute path ◦ pwd with no options ◦ export with no options ◦ unset with no options ◦ env with no options or arguments ◦ exit with no options