More scripting examples
Example 1
Write a shell script that prints out your name and waits for theuser to press the [Enter] key before the script ends.
|
Example 2
You need to use ${varName} to avoid any kind of ambiguity
Write a script to prompt for your name and then create a filewith your ‘<name>_file’ as file name.
|
Example 2:
Write a script that upon invocation shows the time and date andlists all logged-in users. The script then saves this informationto a logfile.
|
|
Example 3
- Write a script which when executed will perform the following:
- Will Create a directory by today’s date in dd-mm-yyyy format(eg. 20-04-2019)
- Will Ask for a file name
- Test if a file by same name exists in your home directory.
- If the file is present Copy the file to the newly createddirectory
- If the file is not present, the script will create the file bythe same name in the newly created directory.
- Finally, display the contents of the newly createddirectory.
Expert Answer
Answer to More scripting examples Example 1 Write a shell script that prints out your name and waits for the user to press the [E…