diff --git a/_scripts/auto_save.sh b/_scripts/auto_save.sh index bbe29e0..e991b80 100755 --- a/_scripts/auto_save.sh +++ b/_scripts/auto_save.sh @@ -1,9 +1,12 @@ #!/bin/bash -# This script runs as a cron job in half-hour intervals to automatically commit changes to the remote repository +# This script automatically commits/pull changes to the remote repository with a generic commit message. -NOTES_PATH="${HOME}/repos/computer_science" -SPACE_TO_UNDERSCORE="${HOME}/repos/bash_scripts/space_to_underscore_filename.sh" +# It is aliased to `cs-update` in .zshrc + +NOTES_PATH="/home/thomas/repos/computer_science" +SPACE_TO_UNDERSCORE="/home/thomas/repos/computer_science/_scripts/space_to_underscore_filename.sh" +CLEAN_IMAGE_DIRECTORY="/home/thomas/repos/computer_science/_scripts/clean_image_directory.sh" cd "$NOTES_PATH" diff --git a/_scripts/random_revision_topic.sh b/_scripts/random_revision_topic.sh index 079c364..2ebb32d 100755 --- a/_scripts/random_revision_topic.sh +++ b/_scripts/random_revision_topic.sh @@ -2,6 +2,8 @@ # This script returns a random topic for me to revise +# It is aliased to cs-revise in .zshrc + # Choose source directories... DIRS_TO_PARSE="../Computer_Architecture ../Databases ../Electronics_and_Hardware ../Operating_Systems ../Programming_Languages/Shell ../Logic" diff --git a/_scripts/space_to_underscore_filename.sh b/_scripts/space_to_underscore_filename.sh new file mode 100755 index 0000000..e9fc4e5 --- /dev/null +++ b/_scripts/space_to_underscore_filename.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# Convert spaces in file and directory names to underscore + +main() { + find . -depth -name '* *' | while read fname; do + new_fname=$(echo $fname | tr " " "_") + if [ -e $new_fname ]; then + echo "File $new_fname already exists. Not replacing $fname" + else + echo "Creating new file $new_fname to replace $fname" + mv "$fname" $new_fname + fi + done +} + +# Run and pipe errors and feedback to logfile + +&>/dev/null +main