X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=zsh-lovers.1.txt;h=2261f758cf87b4bedfa2a7cfee8c0137d28d54c8;hb=bdc422c0b107ea0cb35645b15ed4b72aaf393e9f;hp=fea037f64e850a21daf0e1db792aaa67a3c19434;hpb=8e1e7b4456ed6ef2faac654bb5de1e50f4098701;p=zsh-lovers.git diff --git a/zsh-lovers.1.txt b/zsh-lovers.1.txt index fea037f..2261f75 100644 --- a/zsh-lovers.1.txt +++ b/zsh-lovers.1.txt @@ -210,6 +210,27 @@ Hint: A list of valid glob Qualifiers can be found in zshexpn(1). See ``man 1 zshexpn | less -p'' Qualifiers for details. ------------------------------------------------------------------------------- +# Get the names of all files that *don't* match a pattern *anywhere* on the +# file (and without ``-L'' because its GNUish) + $ print -rl -- *(.^e{'grep -q pattern $REPLY'}) + # or + $ : *(.e{'grep -q pattern $REPLY || print -r -- $REPLY'}) + +# random numbers + $ echo $[${RANDOM}%1000] # random between 0-999 + $ echo $[${RANDOM}%11+10] # random between 10-20 + $ echo ${(l:3::0:)${RANDOM}} # N digits long (3 digits) + +# reverse a word + $ echo "${(j::)${(@Oa)${(s::):-hello}}}" + +# Show newest directory + $ ls -ld *(/om[1]) + +# random array element + $ FILES=( .../files/* ) + $ feh $FILES[$RANDOM%$#FILES+1] + # cat first line in all files in this dir $ for file (*(ND-.)) IFS= read -re < $file @@ -221,7 +242,7 @@ See ``man 1 zshexpn | less -p'' Qualifiers for details. fi # Show me all the .c files for which there doesn't exist a .o file. - $ c=(*.c) o=(*.o(N)) eval 'ls ${${c:#(${~${(j:|:)${o:r}}}).c}:?done}' + $ print *.c(e_'[[ ! -e $REPLY:r.o ]]'_) # All files in /var/ that are not owned by root $ ls -ld /var/*(^u:root) @@ -648,30 +669,30 @@ zsh-4.2.3/Doc/zsh_us.ps # Show only empty files which nor `group' or `world writable' $ ls *(L0f.go-w.) -# find - and list - the ten newest files in directories and subdirs +# Find - and list - the ten newest files in directories and subdirs. # (recursive) $ print -rl -- **/*(Dom[1,10]) -# Print only 5 lines by "ls" command (like ``ls -laS | head -n 5'') +# Print only 5 lines by "ls" command (like ``ls -laS | head -n 5''). $ ls -fl *(DOL[1,5]) -# display the 5-10 last modified files +# Display the 5-10 last modified files. $ print -rl -- /path/to/dir/**/*(D.om[5,10]) -# find all files without a valid owner +# Find all files without a valid owner. $ chmod someuser /**/*(D^u:${(j.:u:.)${(f)"$( /dev/null -# Show only files are owned from group `users' +# Show only files which are owned by group `users'. $ ls -l *(G[users]) ------------------------------------------------------------------------------- @@ -682,32 +703,26 @@ Modifiers are a powerful mechanism that let you modify the results returned by parameter, filename and history expansion. See zshexpn(1) for details. ------------------------------------------------------------------------------- -<<<<<<< /home/dope/download/Source/HG-Repos/zsh-lovers/zsh-lovers.1.txt.orig.432616858 # NOTE: Zsh 4.3.4 needed! -$ autoload -U age + $ autoload -U age # files modified today - $ print *(e:age today now:) + $ print *(e:age today now:) # files modified since 5 pm - $ print *(e-age 17:00 now-) + $ print *(e-age 17:00 now-) # ... since 5 o'clock yesterda $ print *(e-age yesterday,17:00 now-) # ... from last Christmas before today $ print *(e-age 2006/12/25 today-) # ... before yesterday - $ print *(e-age 1970/01/01 yesterday-) + $ print *(e-age 1970/01/01 yesterday-) # all files modified between the start of those dates - $ print *(e:age 2006/10/04 2006/10/09:) + $ print *(e:age 2006/10/04 2006/10/09:) # all files modified on that date - $ print *(e:age 2006/10/04:) + $ print *(e:age 2006/10/04:) # Supply times. $ print *(e-age 2006/10/04:10:15 2006/10/04:10:45-) -# Remove a trailing pathname component, leaving the head. This works like -||||||| /tmp/zsh-lovers.1.txt~base.AvW_ZW -# Remove a trailing pathname component, leaving the head. This works like -======= # Remove a trailing pathname component, leaving the head. This works like ->>>>>>> /tmp/zsh-lovers.1.txt~other.vDaddL # `dirname'. $ echo =ls(:h) /bin @@ -767,7 +782,7 @@ $ autoload -U age # convert 1st char of a word to uppercase $ foo="one two three four" - $ print -r -- "${(C)var}" + $ print -r -- "${(C)foo}" One Two Three Four ------------------------------------------------------------------------------- @@ -829,6 +844,21 @@ ZMV-Examples (require autoload zmv) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *Note:* '-n' means no execution (just print what would happen). At ------------------------------------------------------------------------------- +# Remove illegal characters in a fat32 file system. Illegal characters are +# / : ; * ? " < > | +# NOTE: ``-Q'' and (D) is to include hidden files. + $ unwanted='[:;*?\"<>|]' + $ zmv -Q "(**/)(*$~unwanted*)(D)" '$1${2//$~unwanted/}' + +# Changing part of a filename (i. e. "file-hell.name" -> "file-heaven.name") + $ zmv '(*)hell(*)' '${1}heaven${2}' + # or + $ zmv '*' '$f:s/hell/heaven/' + +# remove round bracket within filenames +# i. e. foo-(bar).avi -> foo-bar.avi + $ zmv '*' '${f//[()]/}' + # serially all files (foo.foo > 1.foo, fnord.foo > 2.foo, ..) $ autoload zmv $ ls * @@ -1402,54 +1432,43 @@ $EUID $GID $EGID $USERNAME $fignore $mailpath $cdpath LINKS ----- Primary site:: - *http://www.zsh.org/[]* + *http://www.zsh.org/[]* Project-page:: - *http://sourceforge.net/projects/zsh/[]* + *http://sourceforge.net/projects/zsh/[]* Z shell page at sunsite.dk:: *http://zsh.sunsite.dk/[]* From Bash to Z Shell: Conquering the Command Line - the book:: *http://www.bash2zsh.com/[]* +"Zsh - die magische Shell" (german book about Zsh) by Sven Guckes and Julius Plenz:: + *http://zshbuch.org/[]* Mailinglistarchive:: *http://www.zsh.org/mla/[]* ZSH-FAQ:: - *http://www.zsh.org/FAQ/[]* + *http://zsh.dotsrc.org/FAQ/[]* Userguide:: *http://zsh.sunsite.dk/Guide/[]* ZSH-Wiki:: - *http://www.zshwiki.org/[]* -Die Zsh als interaktive Shell:: - *http://cssun.rrze.uni-erlangen.de/~sipakale/zshreferat.html[]* + *http://zshwiki.org/home/[]* A short introduction from BYU:: - *http://docs.cs.byu.edu/docs/zsh/index.php[]* + *http://docs.cs.byu.edu/linux/advanced/zsh.html[]* Mouse-Support ;):: *http://stchaz.free.fr/mouse.zsh[]* -Shell Corner: Zsh Suite of "keeper" Functions:: - *http://www.unixreview.com/documents/s=9513/ur0501a/ur0501a.htm[]* -The Z Shell (A Fan Page):: - *http://www.princeton.edu/~kmccarty/zsh.html[]* -Making the Transition to Zsh:: - *http://www.linux-mag.com/cgi-bin/printer.pl?issue=2002-05&article=power[]* Curtains up: introducing the Z shell:: *http://www-128.ibm.com/developerworks/linux/library/l-z.html?dwzone=linux[]* -ZSH-Liebhaberseite:: +ZSH-Liebhaberseite (german):: *http://michael-prokop.at/computer/tools_zsh_liebhaber.html[]* -ZSH-Seite von Michael Prokop:: - *http://www.michael-prokop.at/computer/tools_zsh.html[]* -A Case for the Z Shell on *http://www.daemonnews.org/[]*:: - *http://ezine.daemonnews.org/199910/zsh.html[]* -ZSH-Section from Dotfiles.com:: - *http://www.dotfiles.com/index.php?app_id=4[]* -Writing Zsh Completion Functions:: - *http://www.linux-mag.com/2002-07/power_01.html[]* +ZSH-Seite von Michael Prokop (german):: + *http://michael-prokop.at/computer/tools_zsh.html[]* ZSH Prompt introduction:: *http://aperiodic.net/phil/prompt/[]* +ft's zsh configuration:: + *http://ft.bewatermyfriend.org/computer/zsh.html[]* Adam's ZSH page:: *http://www.adamspiers.org/computing/zsh/[]* Zzappers Best of ZSH Tips:: *http://www.rayninfo.co.uk/tips/zshtips.html[]* Zsh Webpage by Christian Schneider:: - *http://strcat.de/wiki/zsh/[]* - *http://strcat.de/wiki/zsh-german[]* (German translation. Help needed!) + *http://www.strcat.de/zsh/[]* The zsh-lovers webpage:: *http://grml.org/zsh/[]* IRC channel::