diff --git a/copy-codex-docs-config/README.md b/copy-codex-docs-config/README.md new file mode 100644 index 0000000..943c56f --- /dev/null +++ b/copy-codex-docs-config/README.md @@ -0,0 +1,5 @@ +# Run command + +```bash +bash -c "$(wget -qLO - https://raw.githubusercontent.com/bigbeartechworld/big-bear-scripts/master/copy-codex-docs-config/run.sh)" +``` diff --git a/copy-codex-docs-config/run.sh b/copy-codex-docs-config/run.sh new file mode 100644 index 0000000..cc95e87 --- /dev/null +++ b/copy-codex-docs-config/run.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# Default URL of the file to download +default_url="https://raw.githubusercontent.com/codex-team/codex.docs/main/docs-config.yaml" + +# Ask the user for the URL +read -p "Enter the URL (default: $default_url): " url + +# If the user did not enter a URL, use the default URL +if [ -z "$url" ]; then + url="$default_url" +fi + +# Default local path where the file should be copied +default_dest="/DATA/AppData/big-bear-codex-docs/codex-docs-config.local.yaml" + +# Ask the user for the destination path +read -p "Enter the destination path (default: $default_dest): " dest + +# If the user did not enter a path, use the default path +if [ -z "$dest" ]; then + dest="$default_dest" +fi + +# Create the directory if it does not exist +dir=$(dirname "$dest") +mkdir -p "$dir" + +# Use curl to download the file from the URL and save it to the destination path +curl -o "$dest" "$url" + +# Check if the operation was successful +if [ $? -eq 0 ]; then + echo "File copied successfully to $dest" +else + echo "File copy failed" +fi