I am building a custom shell in C and have implemented pipe, fork and file redirection support. I want to enable scripting support so that my shell can be invoked non-interactively as follows:
yosh foo.sh
or
./bar.sh
where bar.sh has the shebang #!/bin/yosh
Should I start by reading in the script file which will be passed as a command line arg to my shell? Is there a need to fork a process for each line in the foo.sh script? Currently, the shell is coded to be interactive with a giant while loop.
Any help/ideas are appreciated. Thank you.