Date: Thu, 20 Jun 2013 17:57:42 +0300 From: Alexander Yerenkow <yerenkow@gmail.com> To: "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org> Subject: Shell variables containing output redirects Message-ID: <CAPJF9wm%2BeW-Ch99E6CZrGPcFt7hepn8y_m3fvLWTFp8PFXEt7Q@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
Hello all! I have a problem with port JBoss72, which tries to behave as long-standing port jboss5: http://svnweb.freebsd.org/ports/head/java/jboss5/files/jboss5.in?revision=302141&view=markup In rc run script there is such line: %%APP_SHORTNAME%%_logging="${%%APP_SHORTNAME%%_logging:-">> ${%%APP_SHORTNAME%%_logdir}/stdout.log 2>> ${%%APP_SHORTNAME%%_logdir}/stderr.log"}" Which provides way to overwrite default log location in /etc/rc.conf. But this not working at all, all these redirects treated as simple parameters for run script. I made small test, to show my problem: #!/bin/sh logfile="supposed-to-be.log" log=">> ${logfile}" echo "a1" >> ${logfile} echo "a2" ${log} cmd="echo \"a3\" ${log}" echo $cmd $cmd more ${logfile} Here's execution output: # ./t1.sh a2 >> supposed-to-be.log echo "a3" >> supposed-to-be.log "a3" >> supposed-to-be.log a1 1. My question is - Which are correct way to specify such redirects to be overridden? 2. tomcat6.in, rubyrep.in, tclhttpd.in, geoserver.in, and many more rc scripts from ports are using something like this: log_args=">> ${tclhttpd_stdout_log} 2>> ${tclhttpd_stderr_log} " and after that use $log_args. Are they silently broken, or am I missing something? 3. Should I build up $cmd, and run eval "$cmd" - would this be nice ro dirty hack? Thanks! -- Regards, Alexander Yerenkow
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAPJF9wm%2BeW-Ch99E6CZrGPcFt7hepn8y_m3fvLWTFp8PFXEt7Q>