Shell script

Shell script to list out the contents of a file

This shell script will list out the contents of a file using MENU DRIVEN, considering the following:
- The user enters the file name (may enter a path)
- The script reads in the file name
- It checks if it exists and it is a file
- If it does not, it warns the user
- Otherwise it should list the contents
Read the rest of this entry »

Shell script for safely delete a file

The advantage of such a script is that the file can be recovered if the deletion was a mistake. The following bash shell script called “safdel.sh” using a turnkey menu to offer the following choices:

  • The user enters the file name to be deleted.
  • The name is checked to make sure the file exists and is an ordinary file. If not, the user is asked again for a file until a valid name is entered or the user exits. Read the rest of this entry »

Shell script to create directory that doesn’t exist

Writing a bash shell script called “ test.sh ” that will creates directory using MENU DRIVEN, considering the following:

  • Making a new directory using (mkdir.sh)
  • Read In directory name (may enter a path)
  • Check If it exists.
  • If it does, warn user.
  • Otherwise create it.

Read the rest of this entry »