diff options
author | Robin Gloster <mail@glob.in> | 2016-07-15 14:41:01 +0000 |
---|---|---|
committer | Robin Gloster <mail@glob.in> | 2016-07-15 14:41:01 +0000 |
commit | 5185bc177309c62e53dad1ad346d1220f0e77bd4 (patch) | |
tree | 52f5878b394abf2ef326765d46880ccbabd84903 /doc/stdenv.xml | |
parent | 07615735077db344539eb9131823600593f0eddf (diff) | |
parent | f402c6321aa3c6e56f5e1f1e36c4ad459c881309 (diff) |
Merge remote-tracking branch 'upstream/master' into hardened-stdenv
Diffstat (limited to 'doc/stdenv.xml')
-rw-r--r-- | doc/stdenv.xml | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/doc/stdenv.xml b/doc/stdenv.xml index 434b61fd6a4b9..303ad2db8a756 100644 --- a/doc/stdenv.xml +++ b/doc/stdenv.xml @@ -1196,10 +1196,24 @@ echo @foo@ <term><function>stripHash</function> <replaceable>path</replaceable></term> <listitem><para>Strips the directory and hash part of a store - path, and prints (on standard output) only the name part. For - instance, <literal>stripHash - /nix/store/68afga4khv0w...-coreutils-6.12</literal> print - <literal>coreutils-6.12</literal>.</para></listitem> + path, storing the name part in the environment variable + <literal>strippedName</literal>. For example: + +<programlisting> +stripHash "/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24" +# prints coreutils-8.24 +echo $strippedName +</programlisting> + + If you wish to store the result in another variable, then the + following idiom may be useful: + +<programlisting> +name="/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24" +someVar=$(stripHash $name; echo $strippedName) +</programlisting> + + </para></listitem> </varlistentry> |