Function asc() for roadwarriors using GNU screen and ssh. Thanks to Axel Beckert.
authorMichael Prokop <mika@grml.org>
Mon, 24 May 2010 22:50:44 +0000 (00:50 +0200)
committerMichael Prokop <mika@grml.org>
Tue, 25 May 2010 07:20:22 +0000 (09:20 +0200)
doc/grmlzshrc.t2t
etc/zsh/zshrc

index 2e879c3..1878148 100644 (file)
@@ -429,6 +429,12 @@ sequences) and the colors they represent.
 Pressing the 'asdf' keys toggles between dvorak or neon and us keyboard
 layout.
 
+: **asc()**
+Login on the host provided as argument using autossh. Then reattach a GNU screen
+session if a detached session is around or detach a currently attached screen or
+else start a new screen.  This is especially useful for roadwarriors using GNU
+screen and ssh.
+
 : **audioburn()**
 Burns the files in ~/ripps (see audiorip() below) to an audio CD.
 Then prompts the user if she wants to remove that directory. You might need
index cd1a220..430d9a7 100644 (file)
@@ -2248,6 +2248,12 @@ check_com 0 || alias 0='return 0'
 check_com S &>/dev/null || alias S='screen'
 check_com s &>/dev/null || alias s='ssh'
 
+# especially for roadwarriors using GNU screen and ssh:
+if ! check_com asc &>/dev/null ; then
+  asc() { autossh -t "$@" 'screen -RdU' }
+  compdef asc=ssh
+fi
+
 # get top 10 shell commands:
 alias top10='print -l ? ${(o)history%% *} | uniq -c | sort -nr | head -n 10'