]> code.delx.au - dotfiles/blobdiff - .bash/interactive
bash: Don't allow stdout redirection to overwrite existing files
[dotfiles] / .bash / interactive
index 969d153ba49dd6320213f42b80332908dfa0d02d..cc4ca57eb9e4565a211d989710aba8ad6f23236c 100644 (file)
@@ -93,7 +93,7 @@ screen*)
 esac
 
 # Useful aliases
-alias ls='ls --color=auto'
+alias ls='ls --color=auto -v'
 alias ll='ls -hlF'
 alias la='ls -ha'
 alias  l='ls -halF'
@@ -104,7 +104,6 @@ alias less='less -R'
 alias grep='grep --color=auto --exclude "*.svn-base"'
 alias scp='scp -o ControlPath=none'
 alias bc='bc -ql'
-alias vv='vncviewer -encodings "tight hextile copyrect"'
 alias watch='watch -n1'
 alias sudo='sudo ' # ability to use aliases with sudo
 alias sudosu='sudo su -l -s /bin/bash'
@@ -115,8 +114,12 @@ alias pstree='ps --forest -weo pid,user:16,args --sort start_time|less -S'
 alias pstime='ps -weo pid,user:16,lstart,args --sort start_time|less -S'
 
 
-# Colorful man pages
+# Super man!
+#  Colourful headings
+#  Terminal title
 function man {
+    tput tsl; echo "man $@"; tput fsl
+
     env \
         LESS_TERMCAP_md=$'\E[01;38;5;74m' \
         LESS_TERMCAP_me=$'\E[0m' \
@@ -144,6 +147,19 @@ function slowshell {
     renice -n 19 -p $$
 }
 
+# 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" "$@" 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
@@ -151,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"