This is a Unix shell like "bash" called "nush". It can operates as follows:
- Accept an optional script file as the first command line argument.
- If there's no script, show a prompt. Your prompt should be "nush$ ". Command input is accepted on the same line after the prompt.
- Read one line of commands from either stdin or the script.
- Execute that line of commands.
- Repeat until EOF or an "exit" command.
- Redirect input:
sort < foo.txt
- Redirect output:
sort foo.txt > output.txt
- Pipe:
sort foo.txt | uniq
- Background:
sleep 10 &
- And:
true && echo one
- Or:
true || echo one
- Semicolon:
echo one; echo two
- Variable Assignment:
FOO=one
- Variable Use:
echo $FOO
- "cd": changes the current directory.
- "exit": exits the shell.
- Subshell:
((sleep 3) && echo one)
- Quotes:
echo ";)echo one"
- Newline:
echo \ one