From owner-freebsd-questions@FreeBSD.ORG Thu Oct 7 16:28:40 2004 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 5A77116A4CE for ; Thu, 7 Oct 2004 16:28:40 +0000 (GMT) Received: from celebrian.forsythia.net (galadriel.forsythia.net [64.81.65.53]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0DEED43D60 for ; Thu, 7 Oct 2004 16:28:40 +0000 (GMT) (envelope-from amoran@forsythia.net) Received: from celebrian.forsythia.net (localhost.forsythia.net [127.0.0.1]) i97GSNGB060393; Thu, 7 Oct 2004 09:28:24 -0700 (PDT) (envelope-from amoran@forsythia.net) Received: from localhost (amoran@localhost)i97GSLba060390; Thu, 7 Oct 2004 09:28:23 -0700 (PDT) (envelope-from amoran@forsythia.net) X-Authentication-Warning: celebrian.forsythia.net: amoran owned process doing -bs Date: Thu, 7 Oct 2004 09:28:20 -0700 (PDT) From: Andrew Moran To: "Pratt, Benjamin E." In-Reply-To: <22ECDF671FCD564398087D64CFCF46BD056E08D6@EXCHANGE.campus.stcloudstate.edu> Message-ID: <20041007092653.V60351@celebrian.forsythia.net> References: <22ECDF671FCD564398087D64CFCF46BD056E08D6@EXCHANGE.campus.stcloudstate.edu> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed cc: freebsd-questions@freebsd.org Subject: RE: Shell script error X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Oct 2004 16:28:40 -0000 The reason that works on Linux and not on FreeBSD is that on Linux "sh" is really bash. On FreeBSD, sh is the bourne shell and bash is bash. Bash will run all sh scripts, but sh will not run all bash scripts. Bash extends the sh language. That script is a bash script, not a sh script. --Andy Friends may come and go but enemies accumulate. On Thu, 7 Oct 2004, Pratt, Benjamin E. wrote: > Sorry, I was using "sh test.sh" to execute the script and getting the > error: > > test.sh: 28: Syntax error: word unexpected (expecting ")") > > When I use "./test.sh" to run it things work fine. > > Sorry for the clutter. > > Ben > > -----Original Message----- > From: owner-freebsd-questions@freebsd.org > [mailto:owner-freebsd-questions@freebsd.org] On Behalf Of Andrew Moran > Sent: Thursday, October 07, 2004 11:02 AM > To: Pratt, Benjamin E. > Cc: freebsd-questions@freebsd.org > Subject: Re: Shell script error > > > That script works fine for me on my box and I'm also running FreeBSD > 5.3-BETA with bash2. > > What kind of error are you getting? What is the output of "bash -x > " (filling in the script name of course). > > --Andy > > > On Oct 7, 2004, at 7:07 AM, Pratt, Benjamin E. wrote: > >> Hello, it's me again. This time I'm trying to do some shell scripting >> but I'm running into a problem with a randomization script that I > found >> on the web. The script I'm trying to run can be found at: >> http://www.bsdbooks.net/shells/scripting/randomvar.html#PICKCARD. >> >> Everything runs fine on different Linux systems that I've used (Red > Hat >> 9, >> Knoppix-STD, PHLAK) but when I run the script on FreeBSD or OpenBSD I >> get >> errors. I'm mainly running FreeBSD 5.3-BETA right now with >> /shells/bash2 >> installed so that's where I'd really like to get it running. >> >> I did change the first line to point to /usr/local/bin/bash but that >> didn't make any difference. >> >> If anyone knows why this won't run, or if anyone has another example > of >> getting a random character (I'd eventually like to generate a random >> hexadecimal character) I'd love to hear from you. >> >> Thanks, >> >> Ben >> _______________________________________________ >> freebsd-questions@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/freebsd-questions >> To unsubscribe, send any mail to >> "freebsd-questions-unsubscribe@freebsd.org" > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to > "freebsd-questions-unsubscribe@freebsd.org" >