Skip to content

rayrayli/simple_shell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NOTE:
Because I blocked on the parent process, so command like cat | ping google.com, will stuck on the cat process, so pipe next
ping command will never be executed. The correct way is to make each process non-block on parent process, record the current pid
of parent process, and at the end of the procedure , traverse all the pid , wait till all the process finished.

Test:

$ sish
sish$ echo $$
6465
sish$ ls
file1 file2
sish$ ls | wc -l
2
sish$ echo $?
0
sish$ find / >/dev/null &
sish$
sish$ aed -e -p passin <file >file.enc
sish$ cmd | sort | uniq -c | sort -n
121 foo
304 bar
sish$ something
something: command not found
sish$ echo $?
127
sish$ rm /etc/passwd
rm: /etc/passwd: Permission denied
sish$ echo $?
1
sish$ exit
$ sish -c date
Sat Nov 29 21:18:07 EST 2014
$ sish -x
sish$ ls
+ ls
file1 file2
sish$ ls | wc -l
+ ls
+ wc -l
2
sish$ cd /tmp
+ cd /tmp
sish$ pwd
+ pwd
/tmp
sish$ cd
+ cd
sish$ pwd
+ pwd
/home/jschauma
sish$ exit
+ e

cd
cd ~
cd ~/Documents
cd ~nobody
exit aaa
cd ab abc
cd / /etc
abcd|efg|
ls|acg
cat|ls
ls -al >>out|cat|wc
pwd>out|cat
abcd|cat
cat|abce
cat|ping google.com
|||||
ls|cat|wc -l
ls|
ls|&cat
ls&&&
>><<<|||||&&&&&<<<


About

A self-implemented simple shell

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published