Created
September 9, 2024 08:33
-
-
Save minthemiddle/cb59506c2366acc8f168b5bb485293cf to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
# @parameters workspace | |
# Set the path to the Daily folder | |
daily_folder="$1/Daily" | |
# Check if the Daily folder exists | |
if [ ! -d "$daily_folder" ]; then | |
echo "Error: Daily folder not found in workspace" | |
exit 1 | |
fi | |
# Get a list of files in the Daily folder | |
files=($(find "$daily_folder" -type f)) | |
# Check if there are any files | |
if [ ${#files[@]} -eq 0 ]; then | |
echo "Error: No files found in Daily folder" | |
exit 1 | |
fi | |
# Select a random file | |
random_file=${files[$RANDOM % ${#files[@]}]} | |
# Open the random file in Nota | |
open -a Nota "$random_file" | |
echo "Opened random file: $random_file" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment