Date: Sat, 23 Feb 2002 21:20:37 -0500 From: "Jeff Jeter" <gsfgf@hotmail.com> To: "Stuart Tanner" <stuart@sigterm.com> Cc: "FreeBSD Questions" <freebsd-questions@freebsd.org> Subject: Re: Linux shell scripts Message-ID: <OE50DKpzxDPHprp5yLZ00009712@hotmail.com> References: <OE727nlT2NqFJ3sl3xb0000970f@hotmail.com> <1014513894.57377.130.camel@osiris.sigterm.com>
next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. ------=_NextPart_000_001F_01C1BCAF.F002D260 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Thanks, installing bash fixed one. The other i referred to in an earlier post regardint turboprint. It is generated by another script which works fine. attached is the generator script. Here is the output: OUTPUT: bsd# turboprint -Plp testpage-a4.ps output.prn turboprint - executing tpfilter manually printer name: lp spool directory: turbo2 *** calling tpfilter now *** head: illegal line count -- 1c eval: 1: Syntax error: "(" unexpected *** tpfilter finished *** the output file may be copied to the printer now for example: cat [OUTPUTFILE] > /dev/lp0 bsd# Thanks Jeff Jeter ----- Original Message ----- From: "Stuart Tanner" <stuart@sigterm.com> To: "Jeff Jeter" <gsfgf@hotmail.com> Cc: "FreeBSD Questions" <freebsd-questions@freebsd.org> Sent: Saturday, February 23, 2002 8:24 PM Subject: Re: Linux shell scripts > On Sun, 2002-02-24 at 13:17, Jeff Jeter wrote: > > I have several apps that use shell schripts. THese apps are designed for linux. when i run these scripts with sh i get odd errors such as Syntax error: unexpected ")" and > > function: not found > > Syntax error: unexpected "}". > > > > I ran the one of them w/ the unexpected "}" w/ csh, and tcsh got this error. > > CONFARGS=--enable-opengl: Connand not found > > prefix=/usr/local: command not found > > prefix: undefined variable > > > > How do i geth these working. I can post the (t)csh output from the other script if needed. > > Are the shells that the scripts are written for installed? > > -- > Stuart Tanner <stuart@sigterm.com> > > Dave Mack: "Your stupidity, Allen, is simply not up to par." > Allen Gwinn: "Yours is." > > ------=_NextPart_000_001F_01C1BCAF.F002D260 Content-Type: application/octet-stream; name="tpfilter" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="tpfilter" #! /bin/sh=0A= #=0A= # tpfilter - line printer input filter for turboprint driver system=0A= # =0A= # Copyright 2000,2001 ZEDOnet=0A= # Version 1.01=0A= # Created 12.4.2000 Florian Zeiler <zeiler@turboprint.de>=0A= # 17.11.2000: improved lprng compatibility (flags, don't use rewindstdin)=0A= # 27.04.2001: DVI printing implemented=0A= #=0A= =0A= PATH=3D/bin:/usr/bin:/usr/local/bin=0A= PATH=3D${PATH}:/usr/bin/TeX:/usr/X11R6/bin=0A= PATH=3D${PATH}:/sbin:/usr/sbin=0A= #export PATH=0A= =0A= # get Turboprint paths=0A= eval $(cat "/etc/turboprint/system.cfg")=0A= LOGFILE=3D"$TPPATH_LOG/turboprint_lpr.log"=0A= TPSTDIN=3D"$TPPATH_FILTERS/tpstdin"=0A= SMBPRINT=3D"$TPPATH_FILTERS/smbprint"=0A= SOCKETPRINT=3D"$TPPATH_FILTERS/socketprint"=0A= NCPPRINT=3D"$TPPATH_FILTERS/ncpprint"=0A= =0A= echo >> $LOGFILE=0A= echo "-----------------------------" >> $LOGFILE=0A= echo "New print job $(date) - command line:" >> $LOGFILE=0A= echo $* >> $LOGFILE=0A= =0A= # parse parameters=0A= # lpr:=0A= # -c -wwidth -llength -iident -n login -h host acct-file=0A= # LPRng:=0A= # -Ffileformatcharacter -ejobdatafile -kcontrolfile=0A= # -Hhost -Jjob -Llogin -Pprintername -Qqueue -aacct-file -dspooldir = -fjobfilename=0A= # -hhost -jjobnumber -llength -nlogin -wwidth -xxpos -yypos acct-file=0A= # -c means transmit file unchanged ("raw") to printer=0A= #=0A= =0A= while [ -z "${1%%-*}" -a -n "$1" ] ; do=0A= temp=3D"${1#-}"=0A= shift=0A= case "$temp" in=0A= a*) # account file (lprng)=0A= {=0A= ACCOUNTFILE=3D"${temp#?}"=0A= };;=0A= e*) # data file (lprng)=0A= {=0A= DATAFILE=3D"${temp#?}"=0A= };;=0A= f*) # job name (lprng)=0A= {=0A= JOBFILE=3D"${temp#?}"=0A= };;=0A= h*) # host name=0A= {=0A= HOST=3D"${temp#?}"=0A= if [ -z "$HOST" ] ; then=0A= HOST=3D"$1"; shift=0A= fi=0A= };;=0A= j*) # job name (lpr) or number (lprng)=0A= {=0A= JOB=3D"${temp#?}"=0A= if [ -z "$JOB" ] ; then=0A= JOB=3D"$1"; shift=0A= fi=0A= };;=0A= n*) # login name=0A= {=0A= LOGIN=3D"${temp#?}"=0A= if [ -z "$LOGIN" ] ; then=0A= LOGIN=3D"$1"; shift=0A= fi=0A= };;=0A= *);; # other flags: ignore=0A= esac=0A= done=0A= =0A= # account file set by -a or is last parameter=0A= if [ -z "$ACCOUNTFILE" ] ; then=0A= eval temp=3D"\${$#}"=0A= if [ -n "$temp" -a "$temp" !=3D "$0" ]; then=0A= ACCOUNTFILE=3D"$temp"=0A= fi=0A= unset temp=0A= fi=0A= =0A= # job name set by -f (lprng) or -j (lpr)=0A= if [ $JOBFILE ] ; then=0A= JOB=3D"$JOBFILE"=0A= fi=0A= =0A= # the spool path is the path to the account file=0A= SPOOLPATH=3D$(dirname $ACCOUNTFILE)=0A= =0A= # the configuration name is the last part the spool path=0A= CONFIGNAME=3D$(basename $SPOOLPATH)=0A= =0A= # create a temporary file=0A= TEMPFILE=3D"$TPPATH_TEMP/tpfilter$$.tmp"=0A= =0A= # find user's home directory=0A= #=0A= YPD=3D"`domainname`"=0A= YPS=3D"`grep -E '^\+' /etc/passwd|head -1c`"=0A= =0A= if [ -n "$YPD" -a "$YPS" =3D "+" ] ; then=0A= set -- `(cat /etc/passwd; ypcat passwd)|grep "^$LOGIN:"|cut -d':' = -f6`=0A= else=0A= set -- `grep "^$LOGIN:" /etc/passwd |cut -d':' -f6`=0A= fi=0A= HOMEDIR=3D"$1"=0A= =0A= # the global config file is in the spool path=0A= CONFIGFILE=3D"$SPOOLPATH/tpprinter.cfg"=0A= =0A= # the user config file is in the home directory=0A= USERCONFIG=3D"$HOMEDIR/.turboprint/$CONFIGNAME.cfg"=0A= =0A= echo "CONFIGNAME=3D$CONFIGNAME CONFIGFILE=3D$CONFIGFILE = USERCONFIG=3D$USERCONFIG" >> $LOGFILE=0A= echo "JOB=3D$JOB DATA=3D$DATAFILE LOGIN=3D$LOGIN HOST=3D$HOST = HOMEDIR=3D$HOMEDIR TEMP=3D$TEMPFILE" >> $LOGFILE=0A= =0A= # evaluate config files; user settings overwrite global settings=0A= eval $(cat $CONFIGFILE)=0A= # user config: put "declare" in front of file (security)=0A= if [ -e "$USERCONFIG" ] ; then=0A= eval $(echo "declare " $(cat $USERCONFIG))=0A= fi=0A= =0A= # check for file header, cut off a chunk for filetype determination=0A= =0A= eval $($TPSTDIN --cut $TEMPFILE)=0A= =0A= if [ $TPHEADER -a $TPHEADER =3D "raw" ] ; then=0A= FILETYPE=3D"tpraw"=0A= else=0A= # get mime file type using command "file"=0A= # translate output to upper case=0A= =0A= FILETYPE=3D$(file $TEMPFILE | tr 'A-Z' 'a-z')=0A= =0A= echo "filetype=3D$FILETYPE" >> $LOGFILE=0A= fi=0A= =0A= =0A= # select input filter depending on file type=0A= =0A= case "$FILETYPE" in=0A= =0A= tpraw)=0A= # raw printer commands from tpconfig=0A= {=0A= USEGS=3D0;=0A= };;=0A= =0A= # first the formats that go through ghostscript=0A= =0A= *postscript*)=0A= # postscript: this is our preferred input=0A= {=0A= # do nothing=0A= INPUTFILTER=3D"";=0A= USEGS=3D1;=0A= };;=0A= =0A= *pdf*document*)=0A= # portable document format:=0A= # almost the same as postscript ??=0A= {=0A= # do nothing=0A= # possibly a temp file is needed...???=0A= INPUTFILTER=3D"";=0A= USEGS=3D1;=0A= };;=0A= =0A= *fig*image*text*)=0A= # fig drawing=0A= {=0A= # use fig2dev=0A= # -Lps - language =3D postscript=0A= # -P - don't create eps but printable ps file=0A= # -c - center on page=0A= INPUTFILTER=3D"fig2dev -Lps -P -c | ";=0A= USEGS=3D1;=0A= };;=0A= =0A= *tex*dvi*file*)=0A= # tex dvi document=0A= {=0A= TEMPFILE1=3D"$TPPATH_TEMP/tpfilter$$.tmp1"=0A= INPUTFILTER=3D"cat - > $TEMPFILE1 | dvips -f $TEMPFILE1 | "=0A= TPCOLORMODE=3D0=0A= USEGS=3D1;=0A= };;=0A= =0A= =0A= *troff*preprocessor*)=0A= # groff document=0A= {=0A= # use grog=0A= # -S - safer mode=0A= # -Tps - output format =3D postscript=0A= GROGCMDLINE=3D$( grog -S -Tps $TEMPFILE)=0A= INPUTFILTER=3D"$GROGCMDLINE | "=0A= TPCOLORMODE=3D0=0A= USEGS=3D1;=0A= };;=0A= =0A= *html*)=0A= # html document=0A= {=0A= # use html2ps=0A= # -e - charset=0A= # -u - underline links=0A= # -H - use hyphenation=0A= INPUTFILTER=3D"html2ps -e ISO-8859-1 -u -H | ";=0A= TPCOLORMODE=3D0=0A= USEGS=3D1;=0A= };;=0A= =0A= # bitmap images that are handled directly by turboprint=0A= =0A= *pc*bitmap*data*)=0A= # bmp image=0A= {=0A= # use bmptoppm; ppm is read by turboprint=0A= # the problem with p*m formats is that there=0A= # is no picture size (dpi) information=0A= INPUTFILTER=3D"bmptoppm | ";=0A= USEGS=3D0;=0A= };;=0A= =0A= *tiff*image*data*)=0A= # tiff image=0A= {=0A= # use tifftopnm; pnm is read by turboprint=0A= INPUTFILTER=3D"tifftopnm | ";=0A= USEGS=3D0;=0A= };;=0A= =0A= *gif*image*data*)=0A= # tiff image=0A= {=0A= # use giftopnm; pnm is read by turboprint=0A= INPUTFILTER=3D"giftopnm | ";=0A= USEGS=3D0;=0A= };;=0A= =0A= *jpeg*image*data*)=0A= # gif image=0A= {=0A= # use djpeg; output format pnm is read by turboprint=0A= # todo: options for djpeg...?=0A= INPUTFILTER=3D"djpeg | ";=0A= USEGS=3D0;=0A= };;=0A= =0A= *pgm*|*pbm*|*ppm*)=0A= # portable grey/bit/pixmap image=0A= {=0A= # pnm is read by turboprint=0A= INPUTFILTER=3D"";=0A= USEGS=3D0;=0A= };;=0A= =0A= *sun*raster*image*data*)=0A= # sunraster image=0A= {=0A= # use rasttopnm; pnm is read by turboprint=0A= # todo: options for rasttopnm...?=0A= INPUTFILTER=3D"rasttopnm | ";=0A= USEGS=3D0;=0A= };;=0A= # pcx not (yet) known by 'file'=0A= =0A= # finally raw ascii=0A= =0A= *)=0A= # default - interpret as ascii text=0A= {=0A= # todo:=0A= # - set page size=0A= # - ...?=0A= =0A= # if a2ps doesn't exist, use enscript, else ??=0A= A2PSCOMMAND=3D"a2ps"=0A= type a2ps &> /dev/null || A2PSCOMMAND=3D"enscript"=0A= A2PSOPTIONS=3D"--output=3D-"=0A= if [ $A2PSCOMMAND =3D "a2ps" ] ; then=0A= A2PSOPTIONS=3D"$A2PSOPTIONS --medium=3D$A2PSMEDIUM"=0A= else=0A= A2PSOPTIONS=3D"$A2PSOPTIONS --media=3D$A2PSMEDIUM"=0A= fi=0A= # either use defaults or set landscape / number of columns=0A= if [ $A2PSDEFAULTS -ne 1 ]; then=0A= if [ $A2PSLANDSCAPE -eq 1 ]; then=0A= A2PSOPTIONS=3D"$A2PSOPTIONS --landscape"=0A= else=0A= A2PSOPTIONS=3D"$A2PSOPTIONS --portrait"=0A= fi=0A= if [ $A2PSHEADERS -eq 0 ]; then=0A= A2PSOPTIONS=3D"$A2PSOPTIONS --no-header"=0A= else=0A= if [ $JOB ]; then=0A= if [ $A2PSCOMMAND =3D "a2ps" ] ; then=0A= A2PSOPTIONS=3D"$A2PSOPTIONS --center-title=3D$JOB"=0A= else=0A= A2PSOPTIONS=3D"$A2PSOPTIONS --title=3D$JOB"=0A= fi=0A= fi=0A= fi=0A= if [ $A2PSCOMMAND =3D "a2ps" ] ; then=0A= A2PSOPTIONS=3D"$A2PSOPTIONS --borders=3D$A2PSBORDERS"=0A= else=0A= if [ $A2PSBORDERS -eq 1 ] ; then=0A= A2PSOPTIONS=3D"$A2PSOPTIONS --borders"=0A= fi=0A= fi=0A= A2PSOPTIONS=3D"$A2PSOPTIONS --columns=3D$A2PSCOLUMNS"=0A= fi=0A= INPUTFILTER=3D"$A2PSCOMMAND $A2PSOPTIONS | "=0A= TPCOLORMODE=3D0=0A= GSDRIVER=3D"pbmraw"=0A= USEGS=3D1=0A= };;=0A= esac=0A= =0A= # end of input filter selection=0A= =0A= # select output filter for printing to a remote printer=0A= =0A= echo "output=3D$REMOTEOUTPUT" >> $LOGFILE=0A= remote=3D"remote"=0A= case $REMOTEOUTPUT in=0A= device)=0A= {=0A= # no output filter needed=0A= OUTPUTFILTER=3D"";=0A= };;=0A= file)=0A= {=0A= # to be implemented=0A= OUTPUTFILTER=3D" | cat > $PRINTTOFILE";=0A= };;=0A= remote)=0A= {=0A= # lpr queue on other unix machine=0A= # the "old" bsd lpr doesn't filter remote output, so=0A= # output is redirected to a second queue - the remote queue=0A= LPROPTIONS=3D"-P$CONFIGNAME$remote"=0A= if [ $LOGIN ]; then=0A= LPROPTIONS=3D"$LPROPTIONS -U '$LOGIN'"=0A= fi=0A= OUTPUTFILTER=3D" | lpr $LPROPTIONS";=0A= };;=0A= smb)=0A= {=0A= # print to a Windows machine via SAMBA=0A= # handled by the smbprint script=0A= # configfile with server name, printer name, etc.=0A= # is passed on to this script=0A= OUTPUTFILTER=3D" | $SMBPRINT $CONFIGFILE";=0A= };;=0A= socket)=0A= {=0A= # print to a network printer or server box port=0A= # handled by the socketprint script=0A= # configfile with server name, port number=0A= # is passed on to this script=0A= OUTPUTFILTER=3D" | $SOCKETPRINT $CONFIGFILE";=0A= };;=0A= ncp)=0A= {=0A= # *** NOT YET TESTED ***=0A= # print to a Netware server via SAMBA=0A= # handled by the ncpprint script=0A= # configfile with server name, printer name, etc.=0A= # is passed on to this script=0A= OUTPUTFILTER=3D" | $NCPPRINT $CONFIGFILE";=0A= };;=0A= esac=0A= =0A= # end of output filter selection=0A= =0A= # build command line for ghostscript=0A= # -sDEVICE=3D name of output format=0A= # -r resolution=0A= # -g output image size in pixels=0A= # -dSAFER interpret postscript in read-only mode=0A= # -dNOPAUSE don't wait after page end=0A= # -dBATCH don't wait after file end=0A= # -sOutputFile=3D name of output file=0A= # - instead of input file: read from stdin=0A= # (alternative: /dev/fd/0 device name of stdin)=0A= GSCOMMANDLINE=3D"gs -sDEVICE=3D$GSDRIVER -r${GSXDPI}x$GSYDPI = -g${GSWIDTH}x$GSHEIGHT\=0A= -dSAFER -dNOPAUSE -dBATCH"=0A= if [ $GSBUFFER -gt 0 ]; then=0A= GSCOMMANDLINE=3D"$GSCOMMANDLINE -dBufferSpace=3D$GSBUFFER"=0A= fi=0A= if [ $GSSCREENLPI -gt 0 ]; then=0A= GSCOMMANDLINE=3D"$GSCOMMANDLINE -dDITHERPPI=3D$GSSCREENLPI"=0A= fi=0A= =0A= # swap odd pages upside-down in duplex mode=0A= #if [ $TPDUPLEX -eq 2 ]; then=0A= # GSCOMMANDLINE=3D"pstops -q '2:0,1U@1(1w,1h)' | $GSCOMMANDLINE"=0A= #fi=0A= =0A= TPCOLORSETTINGS=3D"t${TPTRUEMATCH}x${TPMIRROR}"=0A= if [ $TPUSERCOLOR -gt 0 ]; then=0A= TPCOLORSETTINGS=3D"${TPCOLORSETTINGS}b${TPBRIGHTNESS}o$TPCONTRAST"=0A= TPCOLORSETTINGS=3D"${TPCOLORSETTINGS}i${TPINKVOLUME}s$TPCOLORSATURATION"=0A= TPCOLORSETTINGS=3D"${TPCOLORSETTINGS}g$TPSCREENGAMMA"=0A= TPCOLORSETTINGS=3D"${TPCOLORSETTINGS}y${TPIYELLOW}m$TPIMAGENTA"=0A= TPCOLORSETTINGS=3D"${TPCOLORSETTINGS}c${TPICYAN}k$TPIBLACK"=0A= fi=0A= =0A= if [ $USEGS -eq 1 ] ; then=0A= # command line for turboprint (called from ghostscript)=0A= # -s width x height in 1/1000 inches=0A= # -p left x top position in 1/1000 inches=0A= # -a0 ignore original image aspect=0A= # -v2 print all debug messages=0A= # -d driver name=0A= # -c cartridge id number=0A= # -q quality id number=0A= # -m paper ("medium") id number=0A= # -g color mode (0=3Dbw, 1=3Dgrey, 2=3Dcolor)=0A= # -f page size id number=0A= # -i input feed id number=0A= # -o output tray id number=0A= # -u duplex mode id number=0A= # -t dithering mode id number=0A= # - instead of input&output file: use stdin/stdout=0A= TPCOMMANDLINE=3D"tpprint -s${TPWIDTH}x$TPHEIGHT -p${TPLEFT}x$TPTOP -a0 = -v2\=0A= -d$TPDRIVER -c$TPCARTRIDGE -q$TPQUALITY -m$TPPAPER -g$TPCOLORMODE\=0A= -f$TPPAGESIZE -i$TPFEED -o$TPTRAY -u$TPDUPLEX -t$TPDITHERING\=0A= -y$TPCOPIES -b$TPCOLORSETTINGS -l$LOGFILE - -"=0A= =0A= else=0A= # command line for turboprint image printing (called directly)=0A= # -s width x height in 1/1000 inches=0A= # -v2 print all debug messages=0A= # -p left x top position in 1/1000 inches=0A= # -a keep original image aspect ratio=0A= # -e ignore unprintable margins=0A= # -d driver name=0A= # -c cartridge id number=0A= # -q quality id number=0A= # -m paper ("medium") id number=0A= # -g color mode (0=3Dbw, 1=3Dgrey, 2=3Dcolor)=0A= # -f page size id number=0A= # -i input feed id number=0A= # -o output tray id number=0A= # -u duplex mode id number=0A= # -t dithering mode id number=0A= # - instead of input&output file: use stdin/stdout=0A= if [ $TPPICCENTERX -eq 1 ] ; then=0A= TPPICLEFT=3D"c"=0A= fi=0A= if [ $TPPICCENTERY -eq 1 ] ; then=0A= TPPICTOP=3D"c"=0A= fi=0A= TPCOMMANDLINE=3D"tpprint -s${TPPICWIDTH}x$TPPICHEIGHT -v2\=0A= -p${TPPICLEFT}x$TPPICTOP -a$TPPICASPECT -e$TPPICNOMARGINS\=0A= -d$TPDRIVER -c$TPCARTRIDGE -q$TPQUALITY -m$TPPAPER -g$TPCOLORMODE\=0A= -f$TPPAGESIZE -i$TPFEED -o$TPTRAY -u$TPDUPLEX -t$TPDITHERING\=0A= -y$TPCOPIES -b$TPCOLORSETTINGS -l$LOGFILE - -"=0A= fi=0A= =0A= echo "command lines" >> $LOGFILE=0A= echo "gs: $GSCOMMANDLINE" >> $LOGFILE=0A= echo "tp: $TPCOMMANDLINE" >> $LOGFILE=0A= =0A= TPPIPE=3D"$TPCOMMANDLINE $E2RCOMMANDLINE $OUTPUTFILTER"=0A= =0A= echo "usegs: $USEGS" >> $LOGFILE=0A= =0A= INPUTFILTER=3D"$TPSTDIN --paste $TEMPFILE | $INPUTFILTER"=0A= =0A= if [ $USEGS -eq 1 ] ; then=0A= COMPLETEPIPE=3D"$INPUTFILTER $GSCOMMANDLINE -sOutputFile=3D>($TPPIPE) - = >> $LOGFILE"=0A= else=0A= COMPLETEPIPE=3D"$INPUTFILTER $TPPIPE"=0A= fi=0A= if [ "$FILETYPE" =3D "tpraw" ] ; then=0A= COMPLETEPIPE=3D"$TPSTDIN --paste $TEMPFILE $OUTPUTFILTER"=0A= fi=0A= echo "complete: $COMPLETEPIPE" >> $LOGFILE=0A= =0A= # now execute ghostscript & other pipe commands=0A= =0A= echo "------- before execution of pipe --------" >> $LOGFILE=0A= eval bash $COMPLETEPIPE=0A= echo "------- end of print job --------" >> $LOGFILE=0A= rm $TEMPFILE >> $LOGFILE=0A= if [ -e "$TEMPFILE1" ] ; then=0A= rm $TEMPFILE1 >> $LOGFILE=0A= fi=0A= exit 0=0A= =0A= ------=_NextPart_000_001F_01C1BCAF.F002D260-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?OE50DKpzxDPHprp5yLZ00009712>