Browse Source

xargs-alias: add sed version

master
Brennen Bearnes 1 year ago
parent
commit
79c88a3a86
2 changed files with 14 additions and 0 deletions
  1. +11
    -0
      home/fragments/xargs-alias/README
  2. +3
    -0
      home/fragments/xargs-alias/sed_version.sh

+ 11
- 0
home/fragments/xargs-alias/README View File

@ -1,4 +1,15 @@
No longer includes an xargs invocation.
A response to https://sonomu.club/@gavcloud/104243111086171881 that I'm not
sure is entirely reasonable.
May or may not work on a Mac.
The original question was how to do something like the intent of:
alias lst "!cat ${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection | xargs -0 -I fname echo "put" \'fname\' > files.lftp"
This is a good example of how ridiculously painful quote escaping is in the
shell, and how I don't really have a good set of general habits for avoiding
these problems, apart from doing this kind of thing in a general purpose
programming language instead of involving the shell.

+ 3
- 0
home/fragments/xargs-alias/sed_version.sh View File

@ -0,0 +1,3 @@
function lst {
sed -E "s/'/\\\'/g; s/(.*)/put '\\0'/;" example_selection
}

Loading…
Cancel
Save