Skip to content

Instantly share code, notes, and snippets.

@minthemiddle
Created September 9, 2024 08:33
Show Gist options
  • Save minthemiddle/cb59506c2366acc8f168b5bb485293cf to your computer and use it in GitHub Desktop.
Save minthemiddle/cb59506c2366acc8f168b5bb485293cf to your computer and use it in GitHub Desktop.
#!/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