|
From: | David Given |
Subject: | Re: [Bug-ed] Ed scripts failing in versions after ~1.10 |
Date: | Tue, 22 May 2018 20:13:12 +0200 |
Hello David,
David Given wrote:
> Since about ed 1.11, the ACK fails to build because some of the ed scripts
> won't run any more. Here is an example of one:
>
> #!/bin/sh
> echo "/* this part is generated from $1 at: " `date` "*/"
> ed -s $1<<'EOI'
> 1,/^$/d
> 1,/^$/d
I can't find the problem without a sample of the file processed by this
script. I suggest you to add a --verbose option to the invocation of ed
above in order to get a diagnostic beyond the '?' shown by ed by default:
ed -v -s $1 <<'EOI'
After this change I get this result (using a random text file):
$ ./make.em.gen.new tmp.txt ; echo $?
/* this part is generated from tmp.txt at: Tue May 22 17:35:13 CEST 2018 */
?
script, line 3: No match
1
> Does anyone know what's happening here, and if there's a way to persuade ed
> to quit with an exit status of 0? (I'd rather not discard ed's exit status
> as that would hide processing errors in the scripts.)
You may try adding -l to the invocation of ed:
'-l'
'--loose-exit-status'
Don't exit with bad status if a command happens to "fail" (for
example if a substitution command finds nothing to replace). This
can be useful when 'ed' is invoked as the editor for crontab.
[Prev in Thread] | Current Thread | [Next in Thread] |