query
On this page

writeBash

pkgs.writers.writeBash

Functor
Docs pulled from | This Revision | 10 minutes ago


Like writeScript but the first line is a shebang to bash Can be called with or without extra arguments.

Examples

Without arguments

writeBash "example" ''
echo hello world
''

With arguments

writeBash "example"
{
  makeWrapperArgs = [
    "--prefix" "PATH" ":" "${lib.makeBinPath [ pkgs.hello ]}"
  ];
}
''
  hello
''

Noogle detected

This is a Functor

Learn about functors

Implementation

The following is the current implementation of this function.

writeBash =
    name: argsOrScript:
    if lib.isAttrs argsOrScript && !lib.isDerivation argsOrScript then
      makeScriptWriter (argsOrScript // { interpreter = "${lib.getExe pkgs.bash}"; }) name
    else
      makeScriptWriter { interpreter = "${lib.getExe pkgs.bash}"; } name argsOrScript;