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

Re: [MiNT] scripting



Peter Slegg wrote:
find . -name $FILE -type f -exec perl -pi -e $REPL {} \;

find is useful when you want to search for some files, then apply an action to them. Here, obviously it is useless because you want to execute an action to a single well known file, so just do it:

perl -pi -e $REPL $FILE

Also, find search in the directory given as argument, you passed "." (= the current directory) so it will never find a file located outside it. And also, the argument of -name should be a single name, it can't be an absolute path.
So forget using find.

sed -e $REPL $FILE #>  $FILE

This can't work if you use the same file as input and output. The output will override the input, you mat get an empty file. The -i option of sed can change the contents of the input file, but it may not be supported in old sed versions.

So the following may do what you want (untested):
sed -i $REPL $FILE

--
Vincent Rivière