]> code.delx.au - dotfiles/blobdiff - .bash/interactive
bash: Don't allow stdout redirection to overwrite existing files
[dotfiles] / .bash / interactive
index b16369671022ef30e004f18dcf1bc6a1833a15a5..cc4ca57eb9e4565a211d989710aba8ad6f23236c 100644 (file)
@@ -150,11 +150,16 @@ function slowshell {
 # SSH to an unknown host and print the new known_hosts entry
 function ssh_new {
     local new_known_hosts_file="$(mktemp)"
-    ssh -o UserKnownHostsFile="$new_known_hosts_file" "$1" echo Connection ok
+    ssh -o UserKnownHostsFile="$new_known_hosts_file" "$@" echo Connection ok
     cat "$new_known_hosts_file"
     rm -f "$new_known_hosts_file"
 }
 
+# SSH without verifying host key
+function ssh_unsafe {
+    ssh -o StrictHostKeyChecking=no "$@"
+}
+
 
 # Bash should check the terminal size after every command terminates
 shopt -s checkwinsize
@@ -162,7 +167,8 @@ shopt -s checkwinsize
 # Don't attempt to tab-complete an empty line
 shopt -s no_empty_cmd_completion
 
-
+# Prevent overwriting existing files on stdout redirection
+set -o noclobber
 
 # Local customisations
 [ -r "${HOME}/.bash/interactive_local" ] && source "${HOME}/.bash/interactive_local"