From owner-freebsd-questions@FreeBSD.ORG Wed Apr 30 02:37:13 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 308F037B401 for ; Wed, 30 Apr 2003 02:37:13 -0700 (PDT) Received: from dart.sr.se (dart.SR.SE [134.25.0.132]) by mx1.FreeBSD.org (Postfix) with ESMTP id B246943FA3 for ; Wed, 30 Apr 2003 02:37:11 -0700 (PDT) (envelope-from gunnar@oldie.sr.se) Received: from honken.sr.se (honken.sr.se [134.25.128.27]) by dart.sr.se (8.12.6p2/8.12.6) with ESMTP id h3U9bAY4041872 for ; Wed, 30 Apr 2003 11:37:10 +0200 (CEST) (envelope-from gunnar@oldie.sr.se) Received: from oldie.sr.se (oldie [134.25.200.100]) by honken.sr.se (8.12.3p2/8.12.3) with ESMTP id h3U9bAVT045408 for ; Wed, 30 Apr 2003 11:37:10 +0200 (CEST) (envelope-from gunnar@oldie.sr.se) Received: from oldie.sr.se (localhost [127.0.0.1]) by oldie.sr.se (8.12.9/8.12.9) with ESMTP id h3U9b9G1055388 for ; Wed, 30 Apr 2003 11:37:10 +0200 (CEST) (envelope-from gunnar@oldie.sr.se) Received: (from gunnar@localhost) by oldie.sr.se (8.12.9/8.12.9/Submit) id h3U9b92B055387 for freebsd-questions@FreeBSD.org; Wed, 30 Apr 2003 11:37:09 +0200 (CEST) Date: Wed, 30 Apr 2003 11:37:09 +0200 From: Gunnar Flygt To: FreeBSD Questions Message-ID: <20030430093709.GA55280@sr.se> Mail-Followup-To: Gunnar Flygt , FreeBSD Questions Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i Subject: problems with sh after upgrade to 4.7 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Gunnar Flygt List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Apr 2003 09:37:13 -0000 After upgrade from 4.6.2-RELEASE to 4.7-RELEASE I've got problems with a shellscript that I have on one of my machines. The script (which I've taken over from a far better shellprogammer) looks as follows: #!/bin/sh RTSPCONTROL="/usr/local/etc/rc.d/rtspproxy.sh" cd `dirname $0` cd ../.. PREFIX=/usr/local case $1 in start) echo -n ' rtspproxy' RTSPPROXY=${PREFIX}/sbin/rtspproxy PID_FILE=/var/run/rtspproxy.pid [ -x ${RTSPPROXY} ] && ${RTSPPROXY} > /dev/null & && echo $! > $ {PID_FILE} ;; stop) if [ -f /var/run/rtspproxy.pid ]; then kill `cat /var/run/rtspproxy.pid` rm /var/run/rtspproxy.pid fi ;; check) for pidfile in `find /var/run -name 'rtspproxy.pid'` do if ! kill -0 `head -1 $pidfile` > /dev/null ;then echo "$pidfile process is dead! Restarting..." logger -p daemon.err -t rtspproxy.sh "$pidfile process is dead! Restarting..." ARGS=start rm -f $pidfile ${RTSPCONTROL} ${ARGS} fi done ;; esac The problem line is line 12: [ -x ${RTSPPROXY} ] && ${RTSPPROXY} > /dev/null & && echo $! > $ {PID_FILE} When I run `/usr/local/etc/rc.d/rtspproxy.sh start I get this error /usr/local/etc/rc.d/rtspproxy.sh: 12: Syntax error: "&&" unexpected The script starts the file and redirects the output from rtspproxy (the PID) to the PID_FILE so that the check part can use it later. Since my knowledge in shellscripting is not enough to rewrite the script, I ask for help here. -- Gunnar Flygt OPC Data Sveriges Radio