Remix.run Logo
westurner 5 hours ago

But `ls -print0` is not an option;

  set -x
  mkdir test; cd "$_"
  touch "test "$'\n'"12.txt"
  ls
  for name in `ls`; do echo "$name"; done
  find
  find . -exec echo {} \;
  find . -print0
  find . -print0 | xargs -n 1 -0 echo
  #
  find . -print0 | el -0 -v -x echo
  find . -print0 | el -0 -v -x echo "{0} #"
  find . -print0 | el -0 -v -x echo '"{0}" #'
  find . -print0 | el -0 -x sh -x -c 'echo "{0} #"'
  
Though, I just realized that this doesn't work yet either:

  find . -print0 | el -0 -x -- sh -c 'set -x: echo "{0} #"'
  
westurner/dotfiles/scripts/el: "edit lines" https://github.com/westurner/dotfiles/blob/master/scripts/el...

`el -v/--verbose` is useful because it prints each input; though, I might not have written `el` if I had been aware of `xargs -n/--max-args=1`

tolciho 2 hours ago | parent [-]

  for name in `ls`; do echo "$name"; done
is an unportable and expensive way to write

  for name in *; do printf '%s\n' "$name"; done
but you could also just

  printf '%s\n' *