Mailinglist Archive: opensuse-packaging (43 mails)

< Previous Next >
Re: [opensuse-packaging] use of sed to fix python2 script interpreter
On 03/23/2018 01:07 AM, Marcus Hüwe wrote:
On 2018-03-23 00:28:32 +0100, Bernhard Voelker wrote:
On 03/22/2018 10:39 AM, Sébastien 'sogal' Poher wrote:
sed -i 's|/usr/bin/env\ python|/usr/bin/python2|1'
%{buildroot}/%{_bindir}/%{name}
__________________________________________________^

I've never seen '1' after the 's' command; what should that do?

It replaces the first match. For instance,

marcus@linux:~> echo -e "foobarbar\nfoobar" | sed -e 's/bar/xxx/2'
foobarxxx
foobar

Ah, nice - found it in the manual now, thanks!

https://www.gnu.org/software/sed/manual/html_node/The-_0022s_0022-Command.html#The-_0022s_0022-Command

Still, I don't think this is needed for shebang replacement. Instead,
limiting the address range of the 's' action to line number 1 seems more
useful to me.

Have a nice day,
Berny
--
To unsubscribe, e-mail: opensuse-packaging+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse-packaging+owner@xxxxxxxxxxxx

< Previous Next >
Follow Ups