Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

funny subshell effect



This confused me for a few minutes, I was trying to play a random midi file with
pmidi *(oe:REPLY=\$RANDOM:[1])
but it plays the same one each time, but when i tried
echo *(oe:REPLY=\$RANDOM:[1])
it printed a different one each time

% repeat 3; do echo .(e:REPLY=\$RANDOM:); done
17
25549
6369
% repeat 3; do command echo .(e:REPLY=\$RANDOM:); done
5801
5801
5801

Is this something that must be so? (My guess is yes, but it can't hurt to ask).
(I know I can work around it easily by assigning to a var first).

-- 
Mikael Magnusson



Messages sorted by: Reverse Date, Date, Thread, Author