On Sat, Jan 22, 2022 at 3:05 AM Paul Smith <[email protected]> wrote: > [...] > As mentioned before, the entire script must be contained in a single > logical line if you want the same shell to interpret it all. So you'll > have to add "\" to combine all these into a single logical line:
Thank you for your above knowledgeable and thorough analysis. Got it. > define download_and_unpack > package='$(1)' ; \ > package_URL='$(2)' ; \ > package_directory='$(3)' ; \ > package_code='$(4)' ; \ > package_archive=../archive/`echo "$(package)" | sed 's/.*\///;s/.*=//'` ; > \ > ( \ > if ! gzip -t $(package_archive) > /dev/null 2>&1 ; then \ I tried with your above trick, but noticed that the variable package_archive can be expanded correctly: $ make -j44 w90 [...] package='wannier90-3.1.0'; package_URL='https://codeload.github.com/wannier-developers/wannier90/tar.gz/v3.1.0'; package_directory='W90'; package_code='wannier90'; package_archive=../archive/`echo "" | sed 's/.*\///;s/.*=//'`; As you can see, the following command: package_archive=../archive/`echo "$(package)" | sed 's/.*\///;s/.*=//'`; \ will be passed as: package_archive=../archive/`echo "" | sed 's/.*\///;s/.*=//'`; As you can see, the expansion of "$(package)" has been lost. Based on tries, it seems the following form fixes this problem: package_archive=../archive/`echo "$$(package)" | sed 's/.*\///;s/.*=//'`; \ Regards, HZ
