Last active
May 16, 2024 14:23
-
-
Save angusdev/4a8bdcc1803c2bcc3f1b107d3e1be544 to your computer and use it in GitHub Desktop.
Select count of all tables
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if directory path is provided as an argument | |
if [ $# -ne 1 ]; then | |
echo "Usage: $0 <directory_path>" | |
exit 1 | |
fi | |
directory="$1" | |
# Check if the directory exists | |
if [ ! -d "$directory" ]; then | |
echo "Directory $directory does not exist." | |
exit 1 | |
fi | |
# Search for .pks files in the directory | |
for file in "$directory"/*.pks; do | |
# Extract package name from the file and trim whitespace | |
package_name=$(grep -oiE 'create\s+(or\s+replace\s+)?package' "$file" | awk '{print $2}' | awk '{$1=$1};1' | tr '[:upper:]' '[:lower:]') | |
# Extract file name without extension and convert to lowercase | |
file_name=$(basename "$file" .pks | tr '[:upper:]' '[:lower:]') | |
# Check if package name is not equal to file name | |
if [ "$package_name" != "$file_name" ]; then | |
echo "File: $file" | |
echo "Package name: $package_name" | |
echo "File name : $file_name" | |
echo "Package name is not equal to file name" | |
echo "------------------------" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment