بتاريخ: 24 أكتوبر 200817 سنة comment_141403 رجوا من سيادتكم المساعدة في مشروع Simple Shell Program على نظام لينكس linux Project1: Simple Shell ProgramDevelop a c/c++ program which serve as s shell interface that accept user command and then execute each command in separate process. The shell interface provides a user prompt ( sh> ) after which next command is entered .#define TRUE 1while(TRUE){ //repeat forevertype_prompt(); //display prompt on the screenread_command (command, parameters); //read input from terminalif(fork()!=0){ //fork off child processwaitpid(‐1, &status, 0); //wait for child to exit }else{execve(command, parameters, 0); //execute command }}Write a shell that is similar to the above code snippet, but contains enough code that it actually works so you can test it. You might also add some features such as redirection of in input and output, pipes, and background jobs.If the user enter “& “ at the end of his command, then the process (command) will be executed in the background and the shell WILL not WAIT it to terminate.You can experience background process yourself by trying the following command on bash shell.> kwriteThe kwrite application will be run, and the shell prompt will not prompted until you terminate kwrite. BUT if you tried the following command, then the prompt will return to the user to accept other commands while kwrite (child process) is running! > kwrite & If the user entered exit command, then you will break the loop (exit(0)).Here is an example of how your shell should work: (italics indicate typed commands) % ./myshellsh> echo hello world!hello world!sh > emacs test.txt &process 3456 startedsh > mozilla &process 3457 startedsh > cp test.txt newfile.txtsh > exit ولكم جزيل الشكر تقديم بلاغ
انضم إلى المناقشة
يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.