-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from blbynum/release/1.1.0
prof v1.1.0
- Loading branch information
Showing
3 changed files
with
54 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Directory path where profile files are located | ||
profile_dir="$HOME/.bash_profiles" | ||
|
||
# Text to add at the end of each profile file | ||
text_to_add="# Print a message indicating that the profile has been loaded | ||
echo \"Profile $(basename {profile_file}) loaded.\"" | ||
|
||
# Iterate over each profile file in the directory | ||
for file in "$profile_dir"/*; do | ||
# Exclude .profile_metadata file | ||
if [[ "$file" == "$profile_dir/.profile_metadata" ]]; then | ||
continue | ||
fi | ||
|
||
# Get the filename without the full path | ||
filename=$(basename "$file") | ||
|
||
# Check if the file already contains the specified text | ||
if grep -q "Print a message indicating that the profile has been loaded" "$file"; then | ||
echo "Skipped: $filename already contains the desired text." | ||
else | ||
# Replace {profile_file} with the actual profile filename | ||
modified_text="${text_to_add//\{profile_file\}/$filename}" | ||
# Append the modified text to the end of the file | ||
echo "$modified_text" >> "$file" | ||
echo "Added the desired text to: $filename" | ||
fi | ||
done | ||
|