On 10 Nov 2022, at 15:18, Maik Vermeulen via lists.yoctoproject.org <[email protected]> wrote: > > Hi, > > We have a shell function that's being called from a do_install task: > custom_install() { > DIR=$1 > echo "Operating on '${DIR}'" > > install <some params> -m 0644 ${S}/$DIR/<some file> \ > > ${D}${some_path}/<some_file> > } > > do_install() { > custom_install "dev" > } > > The output of the above is: > Operating on 'dev' > > exit 1 from 'install <some params> -m 0644 <recipe path>/1.0-r0/<expanded S > folder>/${DIR}/<some file> > <recipe path>/image/<some_path>/<some_file>' > > Why is ${DIR} expanded inside the echo, but not in the install command? I > also tried with and without quotes, and with and without curly braces.. > We are on poky sumo.
First, Sumo was last updated in 2019 and is very dead, please move to a supported release: https://wiki.yoctoproject.org/wiki/Releases I’m not convinced that your shell example and the error message match exactly: the error says ${DIR} but sh would have expanded that to either the value, or the empty string. The problem is most likely that you’re using single quotes when you shouldn't. These disable expansion: $ FOO=42 $ echo $FOO 42 $ echo "$FOO" 42 $ echo '$FOO' $FOO Also note that because bitbake’s parse and then sh’s parse can both use ${FOO} for variable expansion, it’s convention to use ${FOO} for *bitbake* variables and then just $FOO for sh variables, as bitbake only expands ${FOO} but sh will expand both ${FOO} and $FOO. If you do ${FOO} and bitbake doesn’t know the variable, it doesn’t get replaced with the empty string (contrary to sh behaviour) so that sh can have a go. Ross
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#58542): https://lists.yoctoproject.org/g/yocto/message/58542 Mute This Topic: https://lists.yoctoproject.org/mt/94937849/21656 Group Owner: [email protected] Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
