Make the script executable from the Project01 directory with:
chmod +x project_analyze.sh
chmod +x feature5script
Possible Arguments:
This script gives a prompt to the user asking to pick a feature of the script to use. The user is prompted to pick a feature according to the number they have been designated. Any other input will lead to an error message.
Feature 1
Feature: Find Tag
Description:
This feature will prompt the user to input a tag and then will search through every commented line in every python file and will echo any lines that include the tag in them. It will also put them in a file named Tag.log in the Project01 directory.
Reference:
Some code was taken from https://unix.stackexchange.com/questions/59893/grep-lines-starting-with-1-in-ubuntu
Execution:
This code will be executed by running the project_analyze.sh script and replying 1 to the prompt
Potential Pitfalls:
Since this file uses grep a potential downfall could be if your tag is the same as the name of a another file or if a commmented file in any file contains the string ".py", they will be included in the result.
Feature 2
Feature: File Size
Description:
This feature will list all the files in the repo and sort them according to their size and also show them in a human-readable format
Reference:
Some code was taken from https://askubuntu.com/questions/811210/how-can-i-make-ls-only-display-files
Execution:
This code will be executed by running the project_analyze.sh script and replying 2 to the prompt
Feature 3
Feature: File Type Count
Description:
This feature will prompt the user to input an extension and then will search through the directory
Execution:
This code will be executed by running the project_analyze.sh script and replying 3 to the prompt
Potential Pitfalls:
Since this file uses grep a potential downfall could be if your extension is also used as a filename. However, this kind of filenaming is bad naming practice and should not be used in the first place
Feature 4
Feature: Switch to Executable
Description:
This feature will change the permissions of the *.sh files so only groups who have write permissions have executable permissions and no one else. The feature also has an option that allows the user to revert the changes and restore the original permissions
Reference:
Some code was taken from [[https://unix.stackexchange.com/questions/39710/how-to-get-permission-number-by-string-rw-r-r]]
Execution:
This code will be executed by running the project_analyze.sh script and replying 4 to the prompt
Feature 5
Feature: Backup and Restore
Description:
This feature allows two options; Backup and Restore. The backup options will delete all *.tmp files from their original location and move them to a directory named backup. The Restore feature will then restore the files in the backup directory to their original location
Execution:
This code will be executed by running the project_analyze.sh script and replying 5 to the prompt.
Note:
DO NOT delete feature5script. This feature works by calling feature5script from the main script
Custom Feature 1
Feature: Word Count
Description:
This feature will ask the user for a prompt asking for a filename and then the feature will return a list of the user 20 most used words in that file. The feature also has a list of the 100 most commonly used words in english writing and will eliminate these words from the count.
Reference:
Some code was taken from [[https://unix.stackexchange.com/questions/39710/how-to-get-permission-number-by-string-rw-r-r]]
Execution:
This code will be executed by running the project_analyze.sh script and replying 7 to the prompt.
Note:
DO NOT delete the file named words. This feature removes the most used words from its wordcount using that file. The file testcase is a testcase for this feature
Custom Feature 2
Feature: Deleting Duplicated Files
Description:
This feature will search through the hashcode for all files and find any that have been duplicated. It will then prompt the user for permission to delete the files that have been unnecessarily duplicated
Execution:
This code will be executed by running the project_analyze.sh script and replying 6 to the prompt