My build of nnn with minor changes
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 
 

33 lignes
766 B

  1. #!/usr/bin/env sh
  2. # Description: Allows for creation of multiple files/directories at the same time.
  3. # Plugin opens a temp file where each entry is to be written on a separate line
  4. #
  5. # Note: Only relative paths are supported. Absolute paths are ignored
  6. # Leading and trailing whitespace in path names is also ignored
  7. #
  8. # Shell: POSIX compliant
  9. # Author: KlzXS
  10. EDITOR="${EDITOR:-vi}"
  11. TMPDIR="${TMPDIR:-/tmp}"
  12. printf "'f'ile / 'd'ir? "
  13. read -r resp
  14. if [ "$resp" = "f" ]; then
  15. #shellcheck disable=SC2016
  16. cmd='mkdir -p "$(dirname "{}")" && touch "{}"'
  17. elif [ "$resp" = "d" ]; then
  18. cmd='mkdir -p {}'
  19. else
  20. exit 1
  21. fi
  22. tmpfile=$(mktemp "$TMPDIR/.nnnXXXXXX")
  23. $EDITOR "$tmpfile"
  24. sed "/^\//d" "$tmpfile" | xargs -n1 -I{} sh -c "$cmd"
  25. rm "$tmpfile"