mirror of
https://github.com/bigbeartechworld/big-bear-scripts.git
synced 2026-07-29 00:32:35 -04:00
Add Copy CodeX Docs config
This commit is contained in:
5
copy-codex-docs-config/README.md
Normal file
5
copy-codex-docs-config/README.md
Normal file
@@ -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)"
|
||||
```
|
||||
37
copy-codex-docs-config/run.sh
Normal file
37
copy-codex-docs-config/run.sh
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user