Skip to content

Commit 34169d1

Browse files
committed
wifi: replace backticks with quotes in usage to prevent command substitution
1 parent 7b08bb6 commit 34169d1

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

src/wifi_from_keychain.sh

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
#!/bin/bash
22

3+
# If the user runs this script with 'sh' (POSIX shell) it may fail due to Bash-only features
4+
# like process-substitution and 'mapfile'. Detect that and print an actionable message.
5+
if [ -z "${BASH_VERSION:-}" ]; then
6+
echo "This script requires Bash. Run with: bash $0 [--db path]" >&2
7+
exit 2
8+
fi
9+
310
set -euo pipefail
411

512
# Extract Wi‑Fi profiles from macOS Keychain and import them into a KeePassXC database
@@ -28,20 +35,20 @@ usage() {
2835
${BLUE}Usage:${NC} bash wifi_from_keychain.sh --db <file.kdbx> [--group "Wi-Fi"] [--key-file path] [--dry-run]
2936
3037
This script reads Wi‑Fi SSIDs stored in the macOS Keychain and adds entries to a KeePassXC
31-
database using `keepassxc-cli`.
38+
database using 'keepassxc-cli'.
3239
3340
Prerequisites:
34-
- macOS `security` tool (built-in)
35-
- `keepassxc-cli` installed and available in PATH
41+
- macOS 'security' tool (built-in)
42+
- 'keepassxc-cli' installed and available in PATH
3643
- Target KeePassXC DB already exists and is writable
3744
3845
The KeePassXC entry created will use:
3946
- Title = SSID
4047
- Password = Wi‑Fi key
4148
- Comment = "imported from macOS keychain"
4249
43-
If `--db` is not provided, the script will use `WIFI_KDBX_DB` from `.env.local` if present.
44-
If `--key-file` is not provided, the script will use `WIFI_KDBX_KEY_FILE` from `.env.local` if present.
50+
If '--db' is not provided, the script will use 'WIFI_KDBX_DB' from '.env.local' if present.
51+
If '--key-file' is not provided, the script will use 'WIFI_KDBX_KEY_FILE' from '.env.local' if present.
4552
4653
EOF
4754
}

0 commit comments

Comments
 (0)