Mailing List Archive

Support open source code!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tlug: sed ?



--------------------------------------------------------
tlug note from Jason Molenda <crash@example.com>
--------------------------------------------------------
> if: Expression Syntax.
> 


This doesn't sound correct.  Looking at the script (just a visual
once-over), I see no syntax errors.  Just to confirm, the entire script
should read (okay, I diddled a little to make it better :-), but I
didn't change anything significant).

------------------------------------------
#! /bin/sh

if [ $# -ne 3 ]
then
        echo Usage: `basename $0` pattern replacement file
        exit 1
fi
if [ ! -f "$3" ]
then
        echo `basename $0`: $3 is not a file
        exit 1
fi

pattern="$1"
replacement="$2"
file="$3"

A="`echo | tr '\012' '\001'`"
sed -e "s$A$pattern$A$replacement$A" $file

exit 0
------------------------------------------

If you're getting the error message above, the way to debug it is to
run it like "sh -x gres a b c".  This will make the Bourne shell print
out what it is doing for every command it executes.

If you don't care about it, that's OK, but it should work.  If it isn't,
I would be a little concerned that something is wrong with your OS.


Jason
-----------------------------------------------------------------
a word from the sponsor will appear below
-----------------------------------------------------------------
The TLUG mailing list is proudly sponsored by TWICS - Japan's First
Public-Access Internet System.  Now offering 20,000 yen/year flat
rate Internet access with no time charges.  Full line of corporate
Internet and intranet products are available.   info@example.com
Tel: 03-3351-5977   Fax: 03-3353-6096


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links