Update README.md
This commit is contained in:
parent
ce3d2b7a8f
commit
9841106eaf
1 changed files with 35 additions and 20 deletions
33
README.md
33
README.md
|
@ -1,8 +1,8 @@
|
|||
###Sagi Dayan 2014
|
||||
Sagi Dayan 2014
|
||||
|
||||
|
||||
# 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>
|
||||
and will create a new process of that <bin name>.
|
||||
|
@ -44,19 +44,22 @@ 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
|
||||
PATH /bin/ .
|
||||
|
||||
### Main issues:
|
||||
* you cannot navigate to different directories.
|
||||
* you cannot pipe command and arguments.
|
||||
* every word will be treated as an argumant!
|
||||
# Main issues:
|
||||
* you cannot navigate to different directories.
|
||||
* you cannot pipe command and arguments.
|
||||
* every word will be treated as an argumant!
|
||||
therefore you cannot write something like:
|
||||
```
|
||||
$ ls -a > "my text.txt"
|
||||
```
|
||||
cshell will see the arguments as:
|
||||
```
|
||||
# ls
|
||||
# -a
|
||||
# >
|
||||
# "my
|
||||
# text.text"
|
||||
|
||||
```
|
||||
and that will throw you an error.
|
||||
|
||||
|
||||
|
@ -65,36 +68,48 @@ PATH /bin/ .
|
|||
# Q&A
|
||||
|
||||
Q: can i redirect output to a file?
|
||||
|
||||
A: yes you can. use the "redirect" char '>' and then the file name.
|
||||
like so:
|
||||
```shell
|
||||
```
|
||||
$ man ls > myFile.txt
|
||||
```
|
||||
```
|
||||
|
||||
Note: the content of the file Will be deleted, in othe words, it acts
|
||||
exactly like '>' in the UNIX Shell. not '>>'.
|
||||
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.
|
||||
|
||||
|
||||
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.
|
||||
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
|
||||
developer of that specific software maked down to exit at.
|
||||
|
||||
|
||||
Q: why 255?
|
||||
|
||||
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
|
||||
exit(1).
|
||||
|
||||
|
||||
Q: why cant i exit cshell with ctrl-c (^C)?
|
||||
|
||||
A: because that was also another task in this Ex.
|
||||
only running childes will be killed, while the main process (cshell)
|
||||
will stay running and kicking.
|
||||
|
||||
|
||||
Q: So how to exit?
|
||||
|
||||
A: run 'exit'.
|
||||
|
||||
|
||||
Q: Can i redirect stderr output to file?
|
||||
|
||||
A: No. the task was to implament only regular output.
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue