A simple command line shell written in the Rust programming language.
- Simple syntax of the command line
- Builtin commands for basic tasks such as printing the arguments
- Builtin commands for working with directories
- Builtin commands for working with files
- Builtin commands for working with processes
- Support for subshells and running commands in the background
- Support for redirection of standard input and output
- Support for pipelines
Syntax of the command line is as simple as possible: the first word is always the name of a command followed by zero or more arguments. The last three arguments may specify redirection and running of the command in the background and must be in the following order: \<_IN_FILE \>OUT_FILE &
.
Install Rust, clone the repo and run cargo run
.
help
... Prints list of builtin commandsname
... Prints the shell namename word
... Sets the shell nameloglevel
... Print the current logging levelloglevel level
... Sets the current loggin level (Error, Info, Debug)print args
... Print the argumentsecho args
... Print the arguments and final newline character
dir.change
... Change the current directory (if no argument given then change to the root directory)dir.where
... Print the current working directorydir.make
... Make one or more directoriesdir.remove
... Remove one or more directoriesdir.list
... List files in the given directorydir.inspect
... Verbose listing of files in the given directory
link.hard original new
... Create hard linklink.soft original new
... Create soft/symbolic linklink.read links
... Print targets of given linksunlink files
... Remove (unlink) given filesrename source dest
... Rename filecpcat source dest
... Copy source file to dest (if source or dest is '-' then use standard input or output, respectively)
pid
... Print PID of the current shellppid
... Print PPID of the current shelllastpid
... Print PID of the last command run in the backgroundstatus
... Print status of the last commandexit
... Exit from the current shellexit status
... Exit from the current shell with the given statusdepth
... Print depth of the current subshellsubshell
... Run a subshell with the given command, e.g.subshell echo 42
pipes
... Create a pipeline, e.g.,pipes "cat /etc/passwd" "cut -d: -f7" "uniq" "sort" "uniq -c"
The original shell specification stems from an assignment in the Operating systems course at Faculity of Computer and Information Science, University of Ljubljana where students must write a command line shell in the C programming language. Hence, we have a simple syntax of the command line and a selected set of commands for file, directory and process manipulation including standard input/output redirection, running commands in the background, and pipeline manipulation.