diff options
author | zimbatm <zimbatm@zimbatm.com> | 2016-06-23 11:30:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-23 11:30:07 +0100 |
commit | 7473e4f2b4754973fc6b4d7e439f2e04e7b65fe4 (patch) | |
tree | b29ee8122229225b687c19a76a3fb1882b382671 /doc | |
parent | 5bff6fef557590d2287853db8a1d25870c0b9dc4 (diff) | |
parent | a1083a5d274bdbff0ebf3d7ea63a4d0d6268b2cc (diff) |
Merge pull request #16398 from tboettch/master
doc: Update stripHash documentation
Diffstat (limited to 'doc')
-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 d5f37aee15eee..b075e0219a545 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> |