For example,
# Execute the pre-hook.
export SHELL=@shell@
param1=@param1@
param2=@param2@
param3=@param3@
param4=@param4@
param5=@param5@
if test -n "@preHook@"; then
. @preHook@
fi
For context, this is from a shell script in a commit from 2004 in the Nixpkgs repo; tried to see if this maybe a reference feature but string "shell" only occurs once (in a case-sensitive search) in the entire file.
The answer by Chris Dodd is correct, insofar as there's no intrinsic meaning to the shell -- and @foo@
is thus commonly used as a sigil. Insofar as you encountered this in nixpkgs, it provides some stdenv tools specifically for implementing this pattern.
As documented at https://nixos.org/manual/nixpkgs/stable/#ssec-stdenv-functions, nixpkgs stdenv provides shell functions including substitute
, substituteAll
, substituteInPlace
&c. which will replace @foo@
values with the content of corresponding variables.
In the context of the linked commit, subsitutions of that form can be seen being performed in pkgs/build-wrapper/gcc-wrapper/builder.sh
:
sed \
-e "s^@gcc@^$src^g" \
-e "s^@out@^$out^g" \
-e "s^@bash@^$SHELL^g" \
-e "s^@shell@^$shell^g" \
< $gccWrapper > $dst
...is replacing @out@
with the value of $out
, @bash@
with the value of $SHELL
, etc.