Files
big-bear-scripts-bigbeartec…/generate-obsidian-livesync-local-ini/run.sh
Christopher 222e6af258 🔧 refactor: Use #!/usr/bin/env bash in all shell scripts (#16)
This commit refactors all the shell scripts to use `#!/usr/bin/env bash` instead of `#!/bin/bash`. This change ensures that the scripts will run with the system's default Bash interpreter, even if it is not located at the standard `/bin/bash` path.
2024-10-23 13:32:15 -05:00

28 lines
996 B
Bash

#!/usr/bin/env bash
# Ask the user for the desired config location
read -p "Enter the location to save the config (default: /DATA/AppData/big-bear-obsidian-livesync/data/local.ini): " location
# If the user doesn't provide a location, default to the specified path
if [ -z "$location" ]; then
location="/DATA/AppData/big-bear-obsidian-livesync/data/local.ini"
fi
# Check if the config file already exists
if [ -e "$location" ]; then
read -p "Warning: $location already exists. Do you want to replace it? (yes/no) " replace
if [[ "$replace" != "yes" ]]; then
echo "Operation cancelled."
exit 1
fi
fi
# Create the directory (and its parents) if it doesn't exist
mkdir -p "$(dirname "$location")"
# Download the file from the given URL and save it to the specified location
curl -L "https://raw.githubusercontent.com/bigbeartechworld/big-bear-casaos/master/Apps/obsidian-livesync/local.ini" -o "$location"
# Confirm to the user
echo "Config saved to $location"