Awesome
ghettocli
A ghetto command line interpreter.
Usage
To compile, simply run make
. Then execute gcli (or myshell, if you insist).
Usage: ./gcli [-v] [-f batchfile]
Interactive mode: ./gcli
Execute a batch file: ./gcli batchfile.sh
Commands
The following commands can be used in both batch and interactive modes.
Provided commands:
-
ls/dir [arg]
- print files in the current directory. If arg is provided, prints the files there. -
pwd
- print the path of the current directory. -
cd [arg]
- change the current directory. -
echo [arg]
- output the current text -
children
- output the number of child processes being executed by the shellSpawn a child process:
sleep 300 &
Spawn another child process:sleep 150 &
Display the children:children
Children: 13839 13840 0 0 0 -
pause
- pause the shell in addition to any child processes -
clear/clr
- clear the display -
help
- displays this file -
quit
- exits the shell and kills all child processes.
Unmatched commands:
[cmd]
- Accepts executable files by absolute path or will search through the PATH environment variable. Default execution is foreground.[cmd] &
- execute a command in the background.
Termination
To terminate the shell and child processes.
- Input
quit
. - Use
Ctl-D
to send the process SIGQUIT. Do not useCtl-C
. We chose to ignoreCtl-C
in order to prevent improper termination when launching another shell within ghettocli, e.g. python.