From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 20 14:57:43 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8A5B0E77 for ; Thu, 20 Jun 2013 14:57:43 +0000 (UTC) (envelope-from yerenkow@gmail.com) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by mx1.freebsd.org (Postfix) with ESMTP id 51C1C1EB2 for ; Thu, 20 Jun 2013 14:57:43 +0000 (UTC) Received: by mail-vc0-f181.google.com with SMTP id lf11so4784206vcb.40 for ; Thu, 20 Jun 2013 07:57:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=viz4tGmTOMPkgT3dZOP9w9Cwko+52ig7eY/1MZBvn6k=; b=tyQMf7ggaWhL/njriwfPUMrB3D9bVrfNtmYfAjr7M1vgQ7iYXf2OVksBiLQcnPpcKu SiRhPQWcrsuls2S29TyAG4/Z8JOuveARw4mNtlvataoTKhaL6s6g4+bMSqWcKNpvLTWK iN8ZxTS5Pc0DIeTZ7JsL1+Y8uLCod3xlNZI7+H5Q7gkG/x4B/AEMD+fl7YJZSZ/Ifjfa iWdhhQxHlbykeE8/IONmC0ecEPJ/+q8Rb7zTfsuCegUa7EJO16fac0mZNHiAUT7IORTV hQYPUmLyuzvcgn9nFN+W/vVE6J4tq0LqPcDArvgisODmgL3ffKhmJrth7bvkmwNmHKfw XrzA== MIME-Version: 1.0 X-Received: by 10.58.207.195 with SMTP id ly3mr3218130vec.77.1371740262504; Thu, 20 Jun 2013 07:57:42 -0700 (PDT) Received: by 10.52.228.2 with HTTP; Thu, 20 Jun 2013 07:57:42 -0700 (PDT) Date: Thu, 20 Jun 2013 17:57:42 +0300 Message-ID: Subject: Shell variables containing output redirects From: Alexander Yerenkow To: "freebsd-hackers@freebsd.org" Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Jun 2013 14:57:43 -0000 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