-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshell_wallet.sh
More file actions
executable file
·43 lines (34 loc) · 823 Bytes
/
shell_wallet.sh
File metadata and controls
executable file
·43 lines (34 loc) · 823 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
COMMANDS_FILE="$SCRIPT_DIR/commands.txt"
if [[ ! -f "$COMMANDS_FILE" ]]; then
echo "Error: $COMMANDS_FILE not found!"
exit 1
fi
commands=()
while IFS= read -r line || [[ -n "$line" ]]; do
commands+=("$line")
done < "$COMMANDS_FILE"
echo "Commands:"
idx=1
for cmd in "${commands[@]}"; do
echo "$idx. $cmd"
idx=$((idx+1))
done
read -p "Select a command (Example: '2' or '2!'): " choice
execute=false
if [[ $choice == *'!'* ]]; then
execute=true
choice=${choice%!} # Remove the '!'
fi
if [[ ! $choice =~ ^[0-9]+$ || $choice -lt 1 || $choice -gt ${#commands[@]} ]]; then
echo "Invalid selection."
exit 1
fi
cmd="${commands[$choice-1]}"
if $execute; then
eval "$cmd"
else
echo -n "$cmd" | pbcopy
echo "Command copied to clipboard."
fi