mirror of
https://github.com/DictXiong/dotfiles.git
synced 2026-06-09 10:46:52 +08:00
Compare commits
2 Commits
a7074fc940
...
cb70dc7cdc
| Author | SHA1 | Date | |
|---|---|---|---|
| cb70dc7cdc | |||
| 9cf6d65692 |
@ -101,7 +101,7 @@ parse_remote() {
|
|||||||
SSH_OPTIONS+=("-o" "PermitLocalCommand=yes")
|
SSH_OPTIONS+=("-o" "PermitLocalCommand=yes")
|
||||||
if [[ "$(get_os_type)" != "msys" ]]; then
|
if [[ "$(get_os_type)" != "msys" ]]; then
|
||||||
test "$DFS_DRY_RUN" = "1" || mkdir -p ~/.ssh/master-socket
|
test "$DFS_DRY_RUN" = "1" || mkdir -p ~/.ssh/master-socket
|
||||||
SSH_OPTIONS+=("-o" "ControlMaster=auto" "-o" "ControlPersist=60s" "-o" "ControlPath=~/.ssh/master-socket/%C")
|
SSH_OPTIONS+=("-o" "ControlMaster=auto" "-o" "ControlPersist=5s" "-o" "ControlPath=~/.ssh/master-socket/%C")
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
# handle input
|
# handle input
|
||||||
|
|||||||
31
scripts/sne
Executable file
31
scripts/sne
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
if [ "$#" -eq 0 ]; then
|
||||||
|
echo "usage: sne <filename or regex pattern>"
|
||||||
|
echo "example: sne config.yaml"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
SEARCH_PATTERN="$1"
|
||||||
|
files=()
|
||||||
|
while IFS= read -r -d $'\0' file; do
|
||||||
|
files+=("$file")
|
||||||
|
done < <(fd "$SEARCH_PATTERN" --type f --print0)
|
||||||
|
file_count=${#files[@]}
|
||||||
|
if [ "$file_count" -eq 0 ]; then
|
||||||
|
echo "no file match '$SEARCH_PATTERN'"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
echo "🔎 found $file_count files:"
|
||||||
|
for file in "${files[@]}"; do
|
||||||
|
echo " 📄 $file"
|
||||||
|
done
|
||||||
|
echo "----------------------------------------"
|
||||||
|
|
||||||
|
read -r -p "edit? [Y/n] " response
|
||||||
|
response=${response:-Y}
|
||||||
|
if [[ "$response" =~ ^[Yy]$ ]]; then
|
||||||
|
vim "${files[@]}"
|
||||||
|
else
|
||||||
|
echo "❌ aborted"
|
||||||
|
fi
|
||||||
@ -40,8 +40,8 @@ test $(echo n | tools/common.sh ask_for_yN "test") = "0"
|
|||||||
test $(echo | tools/common.sh ask_for_yN "test") = "0"
|
test $(echo | tools/common.sh ask_for_yN "test") = "0"
|
||||||
test $(echo | tools/common.sh ask_for_Yn "test") = "1"
|
test $(echo | tools/common.sh ask_for_Yn "test") = "1"
|
||||||
test $(DFS_QUIET=1 tools/common.sh ask_for_Yn "test") = "1"
|
test $(DFS_QUIET=1 tools/common.sh ask_for_Yn "test") = "1"
|
||||||
test "$(DFS_TRUST=1 riot time@is.impt:2222/yes@you-r.right/you@are.really.recht./ibd./try@it,another@host scp /tmp/ ./tmp -D 2>/dev/null)" = 'scp -P 12022 -o ServerAliveInterval=60 -o PermitLocalCommand=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=~/.ssh/master-socket/%C -o ProxyJump=time@is.impt:2222,yes@you-r.right:12022,you@are.really.recht:12022,root@ibd:12022 -r try@it.dxng.net:/tmp/ ./tmp
|
test "$(DFS_TRUST=1 riot time@is.impt:2222/yes@you-r.right/you@are.really.recht./ibd./try@it,another@host scp /tmp/ ./tmp -D 2>/dev/null)" = 'scp -P 12022 -o ServerAliveInterval=60 -o PermitLocalCommand=yes -o ControlMaster=auto -o ControlPersist=5s -o ControlPath=~/.ssh/master-socket/%C -o ProxyJump=time@is.impt:2222,yes@you-r.right:12022,you@are.really.recht:12022,root@ibd:12022 -r try@it.dxng.net:/tmp/ ./tmp
|
||||||
scp -P 12022 -o ServerAliveInterval=60 -o PermitLocalCommand=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=~/.ssh/master-socket/%C -o ForwardX11=yes -o ForwardAgent=yes -r another@host.dxng.net:/tmp/ ./tmp'
|
scp -P 12022 -o ServerAliveInterval=60 -o PermitLocalCommand=yes -o ControlMaster=auto -o ControlPersist=5s -o ControlPath=~/.ssh/master-socket/%C -o ForwardX11=yes -o ForwardAgent=yes -r another@host.dxng.net:/tmp/ ./tmp'
|
||||||
test "$(riot you@example.com:55 -tD ssh --password -- ping -c 1 2>/dev/null)" = 'ssh -p 55 -o ServerAliveInterval=60 -o ForwardX11=yes -o ForwardAgent=yes -o PasswordAuthentication=yes -o PubkeyAuthentication=no you@example.com ping -c 1'
|
test "$(riot you@example.com:55 -tD ssh --password -- ping -c 1 2>/dev/null)" = 'ssh -p 55 -o ServerAliveInterval=60 -o ForwardX11=yes -o ForwardAgent=yes -o PasswordAuthentication=yes -o PubkeyAuthentication=no you@example.com ping -c 1'
|
||||||
|
|
||||||
# check alias
|
# check alias
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user