From a15736cbb0f23e74b47decc363a4cbf45850a0c4 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 17 Oct 2017 20:01:53 +0200 Subject: quote: init --- krebs/5pkgs/simple/quote.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 krebs/5pkgs/simple/quote.nix (limited to 'krebs/5pkgs/simple/quote.nix') diff --git a/krebs/5pkgs/simple/quote.nix b/krebs/5pkgs/simple/quote.nix new file mode 100644 index 00000000..7731e14b --- /dev/null +++ b/krebs/5pkgs/simple/quote.nix @@ -0,0 +1,13 @@ +{ jq, writeDashBin }: + +# usage: quote [ARGS...] +writeDashBin "quote" '' + set -efu + prefix= + for x; do + y=$(${jq}/bin/jq -nr --arg x "$x" '$x | @sh "\(.)"') + echo -n "$prefix$y" + prefix=' ' + done + echo +'' -- cgit v1.2.3