File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+
310set -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
3037This 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
3340Prerequisites:
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
3845The 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
4653EOF
4754}
You can’t perform that action at this time.
0 commit comments