Create a bash in C

Job ID: 32730166

Budget: €15 – €40 EUR

create your own shell named mysh which provides a set of options to the user. When the program starts it will find the logged in user and will display a prompt which will include the username and the current directory. eg (user) :( current-directory)>.
To achieve this you can use the getlogin () call and the getcwd () call. The following options should be supported in this environment:

Always start in the home directory of the logged in user. Support directory change with chdir ()
the user will give a command and it will be executed. After reading the command, your program will use the fork () to create a new child process that will execute the user command. The command from the child process will execute using an exec () family call. The parent process will wait for the child process to finish running (using a wait () or waitpid ()). In addition to print the exit code of the executed command. It will then return to the prompt awaiting the user's new command. Commands with parameters and arguments should be supported (tokenization should be done and the arguments and parameters should be passed to the exec you selected).
When the program starts, record all the results in a log file which will indicate:

Time
The user input

The log files are stored in the ~ / .myshlog file

If a SIGINT or SIGTERM signal is received to ask the user if he really wants to terminate the program, and if so, then terminate it.
Support the mygrep <a_string> <a_file> command which takes as an parameter an alphanumeric and a file, and using 1 thread per line, tries to display the lines where the requested word was found and how many times it was found in total. You can implement it in a separate file if you want.

Useful system calls:

fork (), exec (), open (), close (), read (), write (), dup (), dup2 ()
pthread_create (), pthread_join (), pthread_mutex_lock / unlock
wait (), waitpid ()
signal ()


Implementation Methodology:

Start implementing a program that starts and prints the username and the current directory.
Be sure to make the appropriate redirects to save the user's date and input to the log file
Think about how you will implement the forks for each input command of the user so that the new process can execute this command and return its exit code to the original process.
Think about where protection from simultaneous access is needed to avoid race conditions. Do we need to use semantics for protection when accessing the fd? Justify your answer
Make sure there are no zombie processes
Executable files must be running on a Linux operating system.
Screenshots on each step with a brief explanation on the step. (will be used to create a report leter on by myself)

References of the mentioned before calls: https://tuxthink.blogspot.com/2012/12/c-program-in-linux-to-find-username-of.html
https://stackoverflow.com/questions/298510/how-to-get-the-current-directory-in-a-c-program
https://www.geeksforgeeks.org/chdir-in-c-language-with-examples/