Question: Please show screenshot and source code. Thank you so much !! Overview A shell interface provides the user with a prompt, after which the user




Please show screenshot and source code. Thank you so much !!
Overview A shell interface provides the user with a prompt, after which the user enters the next command The example below illustrates the prompt jsh> and the user's next command cat Prog.java. This command displays the file Prog.java on the terminal using the UNIX cat command: jsh> cat Prog.java Perhaps the casiest technique for implementing a shell interface is to have the program first read what the user enters on the command line (here, cat Prog.java) and then create a separate external process that performs the command. We create the separate process using the ProcessBuilder() object, as illustrated in Figure 3.13. In our example, this separate process is external to the JVM and begins execution when its run () method is invoked. A Java program that provides the basic operations of a command-line shell is supplied below. The main () method presents the prompt jsh> (for java shell) and waits to read input from the user. The programis terminated when the user enters control>
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
