_||____||____||____||____||____||____||____||____||____||____||____|
____||____||____||____||____||____||____||____||____||____||____||_
_||____||____||____||____||____||____||____||____||____||____||____|
____||____||____||____||____||____||____||____||____||____||____||_
_||____||____|| ||____||____|
______||_______ _____.._____ ___ ______||___
_||____||____||___ / ____|| ____| / _ \ ___||____||____|
____||____||____|| \___ \| ._| /_/ \_\ ||____||____||_
_||____||____||___ ___) | |___ __ \_/ __ ___||____||____|
____||____||____|| |_____/|_____|/ / \ \ ||____||____||__
_||____||____||___ ____.._. ._._____._. ._. __||____||____|
____||____||____|| / ___|| | | | ____| | | | ||____||____||__
_||____||____||___ \___ \| |_| | ._| | | | | __||____||____|
____||____||____|| ___) | _ | |___| |___| |___ ||____||____||__
_||____||____|| |____/|_| |_|_____|_____|_____| _||___||____|
____||____||___ ___||____||__
_||____||____||____ |____||____||____||____||____||____||____||____|
____||____||____||____||____||____||____||____||____||____||____||__
_||____||____||____||____||____||____||____||____||____||____||____|
____||____||____||____||____||____||____||____||____||____||____||__
Name | |
---|---|
me | olaleyedaniel2000@gmail.com |
- The shell have exact same output as the
sh
(/bin/sh
) - The only difference is when you print an error, the name of the program must be equivalent to your argv[0] (See below)
$ echo "qwerty" | /bin/sh
/bin/sh: 1: qwerty: not found
$ echo "qwerty" | /bin/../bin/sh
/bin/../bin/sh: 1: qwerty: not found
$
$ echo "qwerty" | ./seashell
./seashell: 1: qwerty: not found
$ echo "qwerty" | ./././seashell
./././seashell: 1: qwerty: not found
$
gcc -Wall -Werror -Wextra -pedantic -std=gnu89 *.c utils/*.c -o seashell
$ ./seashell
($) /bin/ls
seashell main.c shell.c
($)
($) exit
$
$ echo "/bin/ls" | ./seashell
seashell main.c shell.c test_ls_2
$
$ cat test_ls_2
/bin/ls
/bin/ls
$
$ cat test_ls_2 | ./seashell
seashell main.c shell.c test_ls_2
seashell main.c shell.c test_ls_2
$