Chemnitzer Linux-Tage
Sa+So 5.+6. März 2005
Sa 2005-03-05 10-13h Raum W1
Z-Shell Workshop
Sven Guckes chemnitz2005@guckes.net
zsh setup von Julius Plenz
=(0)= default - how to get help
man zsh -> meta man page; list of manuals
man zshall
=(1)= line editing (zle)
keybinding:
bindkey -e
bindkey -v
bindkey | grep ,
"^[," copy-prev-word
mv foo ESC, ->
mv foo foo
multi-line editing mode:
for i in `seq 23`; do
...
=(2)=
mehrfache umleitung:
command >file1 >file2
=(3)= filename globbing
ls *(x)
echo *.[ch]
echo *.(c|h)
ehoc *.(doc|txt)
Rekursion in Unterverzeichnisse mit '**'
zB bei Funktionen _p und _P
Ausnahmen mit '~':
zB *.c~main.c
=(4)= inline expansion
just press TAB! :-)
echo =ls(:h) # head dirname
echo =ls(:t) # tail basename
wget http://www.example.com/some/weird/file.txt
vim !$:t
mv datei{,.txt}(TAB)
=(5)= Aliase: global und subst (seit 4.2.0)
subst aliases:
alias -s txt=vim
alias -s tex=vim
alias -s html=links
alias -s org=links
zsh> foo.txt # calls "vim foo.txt"
zsh> www.grml.org # calls "links foo.txt"
global aliases:
alias -g P='|'
programm1 P programm2
alias -g G="| grep -i --color=auto"
alias -g H='| head'
alias -g L='| less'
alias -g S='| sort'
alias -g T='| tail'
alias -g V='| vim -'
alias -g W='| wc -l'
cat file G foo S -n H -100 L
=(6)= hilfreiche builtins:
cool function:
zB zmv:
for i in *(.); mv $i ${i:l} # "kleine Buchstaben" (lowercase)
for i in *(.); mv $i ${i:u} # "grosse Buchstaben" (uppercase)
zmv '* *' '$f:gs/ /_' # Ersetzen von Leerzeichen durch Unterstriche
c=1 zmv '*.foo' '$((c++)).foo' # Zahl in Dateinamen einbauen
zmv '(*).c' '$1'
zmv '([a-z])(*).pdf' '${(C)1}$2.pdf'
=(7)= builtins als Ersatz fuer andere Werkzeuge
awk: print ${$(date)[1]}
bc: print $[ 2.8*15 ]
basename: for i in **/*.gif; convert $i $i:r.png
seq: echo {23..42}
printf:
bc: printf "%8i\n" $[ 2.8*15 ]
char=C ; print $((#char))
string="Chemnitzer Linux-Tage"
print ascii table:
for i in {0..255}; do print $((#string)); done
=(8)= completion:
cd (TAB) -> list of directories
gpg --(TAB) -> list of long options
kill (TAB) -> list of processes
mutt -f =(TAB) -> list of folders
print -(TAB)
=(9)= eventuell..
Datei auspacken ohne temporäre Dateien zu erzeugen:
sh> gzip -cd foo.gz && less foo
zsh> less <(gzip -cd foo.gz)
Angabe zweier Dateien über ..
sh> cat foo fubar | sort
zsh> sort <f{oo,ubar}
Die Rechte aller Dateien im aktuellen Baum auf 700 setzen:
sh> find . -type f -exec chmod 700 {} ;
zsh> chmod 700 **/*(.)
List details of the executable 'foobar'.
Langes Listing des Programms "foo":
sh> ls -l `which foo`
zsh> ls -l =foo
=(10)= Goodies
uhr.zsh
autoload -U tetris
zle -N tetris
bindkey "^Xt" tetris
CTRL-X t
zsh.vim - syntax coloring for zsh files (MK!)
ausgabe einer zahlenreihe mit fuehrenden nullen
echo {0001..9}
bitte feedback an chemnitz2005@guckes.net
weitermachen beim EasterHegg2005 in Hamburg
von Fr 2005-03-25 bis Mo 2005-03-28
http://eh2005.hamburg.ccc.de/
=== Artikel
* A Case for the Z Shell
http://www.daemonnews.org/199910/zsh.html
* Curtains up: introducing the Z shell
ftp://www6.software.ibm.com/software/developer/library/l-z.pdf
http://www-106.ibm.com/developerworks/linux/library/l-z.html?open&l=335,t=gr,p=Z-Shell
* Making the Transition to Zsh
http://www.linux-mag.com/cgi-bin/printer.pl?issue=2002-05&article=power
* Die Zsh-Liebhaber-Seite (in German)
http://www.infodrom.north.de/~matthi/zsh/
Geschrieben von Matthias Kopfermann,
http://www.infodrom.north.de/~matthi/zsh/zsh-refcard.pdf
ZSH Referenzkarte (PDF)
* Die *neue* ZSH-Lieberhaber Seite
http://www.michael-prokop.at/computer/tools_zsh_liebhaber.html
Matthias Kopfermann und Michael Prokop
* The ZSH-Lovers Manual
URL!
Die ZSH Seite - erweitert und umgesetzt als Manual
von Michael Prokop und Christian Schneider
=== Links
http://zshwiki.org/
=== Leute
Christian "strcat" Schneider:
http://strcat.neessen.net/zsh/
Michael "grml" Prokop:
http://www.michael-prokop.at/computer/tools_zsh.html
David "zzapper" Rayner:
http://www.rayninfo.co.uk/tips/zshtips.html
Thomas "jean-luc" Köhler:
http://www.gott-gehabt.de/800_wer_wir_sind/thomas/Homepage/Computer/zsh/zshrc
http://www.gott-gehabt.de/800_wer_wir_sind/thomas/Homepage/Computer/zsh/uhr.zsh
Sven "nonick" Guckes:
http://www.guckes.net/zsh/
=== Literatur
* ZSH FAQ - Section "2.5: Similarities with bash"
http://zsh.sunsite.dk/FAQ/zshfaq02.html#l14
* [BASH2ZHS]
From Bash to Z Shell: Conquering the Command Line
ISBN 1590593766
http://www.amazon.co.uk/exec/obidos/ASIN/1590593766/qid%3D10 99771908/026-0407757-9210025
* Shell Corner: Zsh Suite of "keeper" Functions
http://www.unixreview.com/documents/s=9513/ur0501a/ur0501a.htm
by Bart Schaefer
=== Distributionen
http://grml.org/zsh/
Linux Live-CD (linux for sysadmins and users of texttools) which
uses zsh as the default shell. includes the zsh-lovers project.
=== Quotes
feature good/bad? "ignore the bits you don't want (need)"
"vor allem diese moechtegern-shells koennen das nicht!" (MK)
=== Ausblick
fiSH! zoidberg