aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/user-scripts/picker.sh
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-01-04 22:33:55 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-01-04 22:33:55 +0530
commit0617c8d90ab49dfcf0d7cefb0a7a6610d742d56e (patch)
tree66e9a743d30fea0fa8f8716be7c4dad7bb952388 /scripts/user-scripts/picker.sh
parent244ba9f953c8036f2c1dd17006baec81ce1fbb42 (diff)
downloadnnn-0617c8d90ab49dfcf0d7cefb0a7a6610d742d56e.tar.gz
Sample scripts to convert NUL to newline
Diffstat (limited to 'scripts/user-scripts/picker.sh')
-rw-r--r--scripts/user-scripts/picker.sh16
1 files changed, 5 insertions, 11 deletions
diff --git a/scripts/user-scripts/picker.sh b/scripts/user-scripts/picker.sh
index 1968c96..8885ed6 100644
--- a/scripts/user-scripts/picker.sh
+++ b/scripts/user-scripts/picker.sh
@@ -1,8 +1,8 @@
-#!/bin/bash
+#!/usr/bin/env sh
# Description: Pick files and pipe the line-separated list to another utility
#
-# Shell: bash
+# Shell: sh
# Author: Arun Prakash Jana
#
# Usage:
@@ -16,12 +16,6 @@
#
# NOTE: This use case is limited to picking files, other functionality may not work as expected.
-nnn -p /tmp/pickerout
-> /tmp/picked
-while read -d $'\0' line ; do
- echo $line >> /tmp/picked
-done < /tmp/pickerout
-echo $line >> /tmp/picked
-cat /tmp/picked
-
-rm /tmp/pickerout /tmp/picked
+nnn -p /tmp/picked
+cat /tmp/picked | tr '\0' '\n'
+rm /tmp/picked