Reference no: EM133316728
Objective: make a script that uses the prompt method for storing a value in a variable.
Description: In this activity, you make a shell script that prompts the user for the name of a directory to create in the scripts directory and then create the directory and display a directory list on the screen to validate that the directory was created.
If necessary, start a virtual machine in the server mode, sign on. Make sure you are in your home directory!
Change to your scripts directory.
1. Change to your scripts directory.
2. Using vim, create an empty file named scr3.
3. Switch to extended mode and display line numbers.
4. Switch to insert mode, and then create a script the performs the following:
• Sets the environment for the script to bash
• Informs the user what the script is doing.
• Prompts the user for the name of the directory.
• Using a variable assignment, set the name of the new directory.
• Create the new directory subordinate to the scripts directory and send all errors to a null file so the user does not see them on the screen.
• Display the appropriate information (a long list showing the newly created directory will do) so the user knows the directory was created.
5. Exit insert mode. Switch to extended mode and then save your changes and exit the vim editor.
6. Change the permissions on file scr3 to give the owner execute permission.
7. Run the script.
a. Make sure the script works as expected.