Skip to content
/ myshell Public

C language simulation for the shell under Linux

Notifications You must be signed in to change notification settings

antct/myshell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Myshell, version 1.0.0

How to use?

  1. first enter your shell directory, confrim files are complete(shell.h, shell.c, utility.c, makefile and readme).
  2. Then use your Linux terminal, enter "make myshell", you can use "./myshell" to run this shell if successful.
  3. Of course, you can enter "make clean" to remove all object files.

Represention rules

  1. : only one parameter.
  2. [optional parameter]: parameter which may be omitted.
  3. ...: several parameters.
  4. (expression): expression.
  5. <type1|type2>: parameter can be type1 or type2.

About internal command

  1. cd ...: change current working directory to the first directory if exists.
  2. dir ...: output information of specified directories.
  3. pwd: output information of current working directory.
  4. echo <string|variable> ...: output an ordinary string or a variable.
  5. clr: clear current displaying page.
  6. exit [status]: exit will status if exists, otherwise, exit with status 0.
  7. quit: exit with status 0.
  8. more ...: output contents full of displaying window size, use "q", "enter", "blank" to ctrl.
  9. help: provide help manuals processed by instruction "more".
  10. date: display current date and time.
  11. time : calculate time costing in the process.
  12. exec ...: execute commands.
  13. set: output all variables with format "a=b".
  14. unset : delete specified variable.
  15. environ: output all environment variables with format "a=b".
  16. bg : move job to background.
  17. fg : move job on the stage.
  18. jobs: output all jobs in background.
  19. kill : kill specified job.
  20. umask [n]: output mask value or set mask value.
  21. test [(expression)] (expression): test logical relation between expressions.
  22. atest [(expression)] (expression): output the value after testing.
  23. shift: move the parameter list to the left for one bit.
  24. continue: skip after commands.
  25. mv : move file from one directory to another.
  26. cp : copy file from one directory to another.
  27. touch ...: create new files if not exists.
  28. mkdir ...: create new directories if not exists.
  29. rm ...: delete files if exists.
  30. rmdir ...: delete directories if exists.
  31. history: output all previous commands.
  32. head [n] : display first n lines in file, set n as default value 10 if it omitted.
  33. tail [n] : display last n lines in file, set n as default value 10 if it omitted.
  34. myshell [ ...]: run batch file.

About external command

  1. external command will be executed by your original shell. Such as instructions "ls", "cat" and so on.
  2. emmmmm, here exists a problem not solved that some variables may be different.
  3. external command using external variables while internal commands using internal variables.

About signal

  1. when using this shell, ctrl+c are shielded.
  2. when a child process is called, ctrl+z can hang this process stopped.
  3. Arrows are not supported now.

About environment

  1. initial directory is your home directory in extern system.
  2. initial variables are empty.
  3. initial environment variables are "HOME", "PWD" and "shell".

About pipe and redirection

  1. pipe supported, but no more than 10 pipes please.
  2. redirection supported, includeing '>', '>>' and '<'.

About background

  1. symbol "&" supported, process will be moved to background.

Some notes

  1. please enter your command separated with a blank strictly.
  2. instruction "umask" can only change the value of internal shell rather than extern shell.
  3. and so on.

About

C language simulation for the shell under Linux

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published