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.
 
 
 
 
 
 

36 lignes
901 B

  1. #!/usr/bin/env bash
  2. # Description: Splits the file passed as argument or joins selection
  3. #
  4. # Note: Adds numeric suffix to split files
  5. # Adds '.join' suffix to the first file to be joined and saves as output file for join
  6. #
  7. # Shell: Bash
  8. # Author: Arun Prakash Jana
  9. selection=~/.config/nnn/.selection
  10. echo -n "press 's' (split current file) or 'j' (join selection): "
  11. read resp
  12. if [ "$resp" = "j" ]; then
  13. if [ -s "$selection" ]; then
  14. arr=$(cat $selection | tr '\0' '\n')
  15. { read -r file; } <<< "$arr"
  16. file=$(basename "$file").out
  17. cat "$selection" | sort -z | xargs -0 -i cat {} > "$file"
  18. fi
  19. elif [ "$resp" = "s" ]; then
  20. if ! [ -z "$1" ] && [ -f "$1" ] ; then
  21. # a single file is passed
  22. echo -n "split size in MB: "
  23. read size
  24. if ! [ -z "$size" ]; then
  25. split -d -b "$size"M "$1" "$1"
  26. fi
  27. fi
  28. fi