See ``man 1 zshexpn | less -p'' Qualifiers for details.
-------------------------------------------------------------------------------
+# 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
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)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*Note:* '-n' means no execution (just print what would happen). At
-------------------------------------------------------------------------------
+# 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 *