On Wed, Feb 8, 2012 at 3:05 PM, Phil Holmes <m...@philholmes.net> wrote: > ----- Original Message ----- From: "Julien Rioux" <julien.ri...@gmail.com> > To: "Phil Holmes" <m...@philholmes.net> > >> Yes, the DEPTH=... confuses bash, so eval is needed. Please try >> something like the attached though. It removes all the exec stuff and >> will be much easier to understand for future contributors. The exec >> stuff is needed only for complex redirection, for example if you >> wanted stderr to appear both on the terminal and in the log file. But >> currently we just redirect both stdout and stderr to the log file, and >> this scenario does not need complex exec stuff. >> >> Regards, >> Julien > > > eval $1 >& $2 > > gives: > > ./new-run-check.sh: 2: Syntax error: Bad fd number - finger trouble on the > redirect. eval $1 &> $2 simply doesn't redirect the output - it appears on > the terminal and no logfile is created. I spent quite a long time a few > weeks ago getting this to work and was surprised it didn't, but convinced > myself that the way I arrived at is pretty much the only solution. I > understand what you say about maintainability, but I've commented it quite a > bit and the script could just be removed if it was too confusing, so I'm not > convinced it's worth too much time repeating what I did earlier to try to > get this to work. > > -- > Phil Holmes >
I guess I made a typo and it should be eval $1 &> $2 # Redirect both stdout and stderr to log file. but apparently my version of bash understands either &> or >&, and it works perfectly: $ ./run.sh "DEPTH=../.. ls run.sh x" mylogfile An error occured. Please check the logfile mylogfile $ cat mylogfile ls: cannot access x: No such file or directory run.sh Are you sure you run the script with bash? What do you get from bash --version? I have bash --version GNU bash, version 4.1.10(1)-release (x86_64-suse-linux-gnu) Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software; you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Cheers, Julien _______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel