Update README.md
This commit is contained in:
parent
ce3d2b7a8f
commit
9841106eaf
1 changed files with 35 additions and 20 deletions
55
README.md
55
README.md
|
@ -1,8 +1,8 @@
|
||||||
###Sagi Dayan 2014
|
Sagi Dayan 2014
|
||||||
|
|
||||||
|
|
||||||
# OS course Ex1 - Home - cshell - LINUX/UNIX
|
# OS course Ex1 - Home - cshell - LINUX/UNIX
|
||||||
## a basic Terminal emulator written in C for OS course in JCE.
|
#### a basic Terminal emulator written in C for OS course in JCE.
|
||||||
|
|
||||||
This Terminal will be able to run almost all programs in the PATH /bin/<bin name>
|
This Terminal will be able to run almost all programs in the PATH /bin/<bin name>
|
||||||
and will create a new process of that <bin name>.
|
and will create a new process of that <bin name>.
|
||||||
|
@ -44,20 +44,23 @@ the main idea is to be able to run & create processes via commands.
|
||||||
you can enter almost any basic command (and some more) that the binarys are in
|
you can enter almost any basic command (and some more) that the binarys are in
|
||||||
PATH /bin/ .
|
PATH /bin/ .
|
||||||
|
|
||||||
### Main issues:
|
# Main issues:
|
||||||
* you cannot navigate to different directories.
|
* you cannot navigate to different directories.
|
||||||
* you cannot pipe command and arguments.
|
* you cannot pipe command and arguments.
|
||||||
* every word will be treated as an argumant!
|
* every word will be treated as an argumant!
|
||||||
therefore you cannot write something like:
|
therefore you cannot write something like:
|
||||||
$ ls -a > "my text.txt"
|
```
|
||||||
cshell will see the arguments as:
|
$ ls -a > "my text.txt"
|
||||||
# ls
|
```
|
||||||
# -a
|
cshell will see the arguments as:
|
||||||
# >
|
```
|
||||||
# "my
|
# ls
|
||||||
# text.text"
|
# -a
|
||||||
|
# >
|
||||||
and that will throw you an error.
|
# "my
|
||||||
|
# text.text"
|
||||||
|
```
|
||||||
|
and that will throw you an error.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,36 +68,48 @@ PATH /bin/ .
|
||||||
# Q&A
|
# Q&A
|
||||||
|
|
||||||
Q: can i redirect output to a file?
|
Q: can i redirect output to a file?
|
||||||
|
|
||||||
A: yes you can. use the "redirect" char '>' and then the file name.
|
A: yes you can. use the "redirect" char '>' and then the file name.
|
||||||
like so:
|
like so:
|
||||||
```shell
|
```
|
||||||
$ man ls > myFile.txt
|
$ man ls > myFile.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
Note: the content of the file Will be deleted, in othe words, it acts
|
Note: the content of the file Will be deleted, in othe words, it acts
|
||||||
exactly like '>' in the UNIX Shell. not '>>'.
|
exactly like '>' in the UNIX Shell. not '>>'.
|
||||||
Note2: the file name must be in one word. as you can see in Issues,
|
Note2: the file name must be in one word. as you can see in Issues,
|
||||||
cshell dose not support an argument that is seperated with space or tab.
|
cshell dose not support an argument that is seperated with space or tab.
|
||||||
|
|
||||||
|
|
||||||
Q: what is that wired number before the prompt?
|
Q: what is that wired number before the prompt?
|
||||||
|
|
||||||
A: that wierd number is atually the return code of the last process that you ran.
|
A: that wierd number is atually the return code of the last process that you ran.
|
||||||
the Unix defult return code of a succssesful end of process will be 0. otherwise,
|
the Unix defult return code of a succssesful end of process will be 0. otherwise,
|
||||||
in case fo an error or an exception, the code can be any number (code) that the
|
in case fo an error or an exception, the code can be any number (code) that the
|
||||||
developer of that specific software maked down to exit at.
|
developer of that specific software maked down to exit at.
|
||||||
|
|
||||||
|
|
||||||
Q: why 255?
|
Q: why 255?
|
||||||
|
|
||||||
A: as i noticed, the defaul code of "exit(1)" is actually 256, but
|
A: as i noticed, the defaul code of "exit(1)" is actually 256, but
|
||||||
in the exersize wanted to return 255 in case of an "unknown command" or default
|
in the exersize wanted to return 255 in case of an "unknown command" or default
|
||||||
exit(1).
|
exit(1).
|
||||||
|
|
||||||
|
|
||||||
Q: why cant i exit cshell with ctrl-c (^C)?
|
Q: why cant i exit cshell with ctrl-c (^C)?
|
||||||
|
|
||||||
A: because that was also another task in this Ex.
|
A: because that was also another task in this Ex.
|
||||||
only running childes will be killed, while the main process (cshell)
|
only running childes will be killed, while the main process (cshell)
|
||||||
will stay running and kicking.
|
will stay running and kicking.
|
||||||
|
|
||||||
|
|
||||||
Q: So how to exit?
|
Q: So how to exit?
|
||||||
|
|
||||||
A: run 'exit'.
|
A: run 'exit'.
|
||||||
|
|
||||||
|
|
||||||
Q: Can i redirect stderr output to file?
|
Q: Can i redirect stderr output to file?
|
||||||
|
|
||||||
A: No. the task was to implament only regular output.
|
A: No. the task was to implament only regular output.
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue