On Wed, Feb 18, 2009 at 1:03 AM, Dan McGee <dpmcgee@gmail.com> wrote:
+ +case $1 in + -l|--locate) + cmd() { locate -0 -e -b \*.pacnew \*.pacorig \*.pacsave; } + ;; + *) + cmd() { find /etc/ -name \*.pacnew -o -name \*.pacorig -o -name \*.pacsave -print0; } + ;; +esac Isn't this over-complex? It just seems like overkill to me. I'd rather have the argument searching be in one place, and then cmd() does an if/else based on the result of that (similar to makepkg, although they really seemed to hate on that in #bash).
Oh no, in this case it's just me being very stupid. In the beginning I just had a simple variable : cmd="find ..." that I could override. I realized it didn't work, so I switched cmd to be a function. It didn't occur to me I could simply have an if/else inside cmd() rather than keep overriding it :)
+ +exec 3< <(cmd) This is a bit...sick. I agree with Aaron here.
I agree it's a bit sick, it would be interesting to know if there is a cleaner way that is still as correct. Anyway, see my answer to Aaron.