My build of nnn with minor changes
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 
 

37 строки
1.0 KiB

  1. #!/usr/bin/env sh
  2. # Description: Create and verify md5 checksums
  3. #
  4. # If selection is used: it will generate one md5 file containing the checksums and file names
  5. # [with paths if they are in another directory]
  6. # If file is used: if the file is .md5 file, then it does the check
  7. # if the file is not .md5 file, it creates the md5 file from it
  8. #
  9. # Shell: POSIX compliant
  10. # Author: ath3
  11. selection=~/.config/nnn/.selection
  12. resp=f
  13. if [ -s "$selection" ]; then
  14. echo -n "work with selection (s) or current file (f) [default=f]: "
  15. read resp
  16. fi
  17. if [ "$resp" = "s" ]; then
  18. arr=$(cat $selection | tr '\0' '\n')
  19. { read -r file; } <<< "$arr"
  20. file=$(basename "$file").md5
  21. cat "$selection" | sed 's|'"$PWD/"'||g' | xargs -0 -i md5sum {} > "$file"
  22. else
  23. if ! [ -z "$1" ] && [ -f "$1" ]; then
  24. if [ $(echo $1 | grep \.md5$) ]; then
  25. cat "$1" | md5sum -c
  26. read
  27. else
  28. file=$(basename "$1").md5
  29. md5sum "$1" > "$file"
  30. fi
  31. fi
  32. fi