about summary refs log tree commit diff
path: root/sh/snippets
diff options
context:
space:
mode:
authorXiao Pan <gky44px1999@gmail.com>2024-04-28 14:27:24 -0700
committerXiao Pan <gky44px1999@gmail.com>2024-04-28 14:27:24 -0700
commit26d3949bd82d9788fc786fbd911f909b36a1c70d (patch)
tree7424484412b4c7b208de3f57a8f9fcdc042441af /sh/snippets
parent2036cee1f00d93a7ff6aa76ed92661e66e14ec51 (diff)
update
Diffstat (limited to 'sh/snippets')
-rw-r--r--sh/snippets7
1 files changed, 7 insertions, 0 deletions
diff --git a/sh/snippets b/sh/snippets
index efbbd1e..4c96704 100644
--- a/sh/snippets
+++ b/sh/snippets
@@ -59,3 +59,10 @@ find "$HOME/archive/music" -type f -name '*.wav' -execdir sh -c '
 		ffmpeg -i "$i" "$i.flac" && rm "$i"
 	done
 ' sh '{}' \+
+
+# need to pass password through pipe to not show in ps
+# another way is use `grep -f-` to read pattern from stdin, but it is hard to specify filenames with spaces that way, `grep ... $(find ... | printf %q ...)` somehow thinks 'a b' as two files 'a and b', e.g., This DOES NOT WORK: `pass albiononline.com | { IFS= read -r p; printf '%s' "$p";} | grep --color=auto -IR -f- $(find . -type d \( -iname '*sandbox*interactive*' -o -iname '*albion*' \) -print0 | xargs -0 printf '%q ')`, not sure why
+{
+	pass albiononline.com | { IFS= read -r p; printf '%s\0' "$p";}
+	find . -type d \( -iname '*sandbox*interactive*' -o -iname '*albion*' \) -print0
+} | xargs -0 grep --color=auto -IR