> -----Original Message----- > From: Paulo Neves <ptsne...@gmail.com> > Sent: den 15 juni 2022 15:51 > To: Peter Kjellerstedt <peter.kjellerst...@axis.com>; Ross Burton > <ross.bur...@arm.com> > Cc: openembedded-core@lists.openembedded.org > Subject: Re: [OE-core] [PATCH v5 6/7] utils: Add cmdline_shebang_wrapper > util. > > On 6/15/22 15:11, Peter Kjellerstedt wrote: > >> -----Original Message----- > >> From: openembedded-core@lists.openembedded.org <openembedded- > >> c...@lists.openembedded.org> On Behalf Of Ross Burton > >> Sent: den 15 juni 2022 12:52 > >> To: ptsne...@gmail.com > >> Cc: openembedded-core@lists.openembedded.org > >> Subject: Re: [OE-core] [PATCH v5 6/7] utils: Add > cmdline_shebang_wrapper > >> util. > >> > >> On 14 Jun 2022, at 16:11, Paulo Neves via lists.openembedded.org > >> <ptsneves=gmail....@lists.openembedded.org> wrote: > >>> +create_cmdline_shebang_wrapper () { > >> The indentation in this function is a mix of tabs and spaces, please > >> unify. > >> > >>> + argument="$(basename "$(head -n1 $cmd | sed -e 's|#![ ]*||g' )”)” > >> [ ]* seems overly, complex, no need for the brackets. I’d anchor to the > >> beginning of the line, and remove the g as there’s only one expected. > > This should work: > > > > argument=$(basename "$(sed -ne 's/^#! *//p;q')" $cmd) > > > > However, if the first line is something like "#!/usr/bin/env python3", then > > $argument will be "env python3" and somehow I assume that is not exactly > > what the rest of the code expects. > > The use case is that whatever is in shebang should be extracted and ran > verbatim, so truncating like your suggestion can work but has slightly > different semantic.
Umm, my suggested line above should give exactly the same output as yours, only with fewer commands... > >> Might also be wise to assert that you found something here, so running > >> this on an ELF fails with an obvious error. > >> > >> Ross > > //Peter > > > Paulo Neves //Peter
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#166995): https://lists.openembedded.org/g/openembedded-core/message/166995 Mute This Topic: https://lists.openembedded.org/mt/91751270/21656 Group Owner: openembedded-core+ow...@lists.openembedded.org Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-