From owner-freebsd-questions@FreeBSD.ORG Fri Aug 6 17:35:33 2010 Return-Path: Delivered-To: freebsd-questions@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 177351065672; Fri, 6 Aug 2010 17:35:33 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (lurza.secnetix.de [IPv6:2a01:170:102f::2]) by mx1.freebsd.org (Postfix) with ESMTP id 8E4248FC13; Fri, 6 Aug 2010 17:35:32 +0000 (UTC) Received: from lurza.secnetix.de (localhost [127.0.0.1]) by lurza.secnetix.de (8.14.3/8.14.3) with ESMTP id o76HZE1t051335; Fri, 6 Aug 2010 19:35:29 +0200 (CEST) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.14.3/8.14.3/Submit) id o76HZEal051334; Fri, 6 Aug 2010 19:35:14 +0200 (CEST) (envelope-from olli) Date: Fri, 6 Aug 2010 19:35:14 +0200 (CEST) Message-Id: <201008061735.o76HZEal051334@lurza.secnetix.de> From: Oliver Fromme To: freebsd-bugs@FreeBSD.ORG, freebsd-questions@FreeBSD.ORG, eb30750@gmail.com In-Reply-To: X-Newsgroups: list.freebsd-bugs User-Agent: tin/1.8.3-20070201 ("Scotasay") (UNIX) (FreeBSD/6.4-PRERELEASE-20080904 (i386)) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.3.4 (lurza.secnetix.de [127.0.0.1]); Fri, 06 Aug 2010 19:35:29 +0200 (CEST) Cc: Subject: Re: misc/149335: shell script runs on Linux but not on freebsd X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd-questions@FreeBSD.ORG, eb30750@gmail.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Aug 2010 17:35:33 -0000 Redirected to the -questions. Paul wrote: > What about matching the ' marks in this section? I get a command error. > > > > # XXX: put extraction in its own function > > > MAGIC_NUMBER=`od -An -t u4 -N 4 -j $MAGIC_OFFSET "$file" | tr -d ' '` That command works fine for me: $ MAGIC_OFFSET=42 $ file=/etc/motd $ MAGIC_NUMBER=`od -An -t u4 -N 4 -j $MAGIC_OFFSET "$file" | tr -d ' '` $ echo $MAGIC_NUMBER 540684323 What's the exact error message that you get, and what are the values of the variables involved? By the way, when debugging shell scripts it is very helpful to run the shell with -vx. Then it prints the script as it is being parsed, and additionally each command is printed after expansion. Best regards Oliver -- Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M. Handelsregister: Registergericht Muenchen, HRA 74606, Geschäftsfuehrung: secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün- chen, HRB 125758, Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart FreeBSD-Dienstleistungen, -Produkte und mehr: http://www.secnetix.de/bsd "I invented Ctrl-Alt-Delete, but Bill Gates made it famous." -- David Bradley, original IBM PC design team