My build of nnn with minor changes
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env sh
  2. # Description: Toggle mount status of a device using pmount
  3. # If the device is not mounted, it will be mounted.
  4. # If the device is mounted, it will be unmounted and powered down.
  5. #
  6. # Shell: POSIX compliant
  7. # Author: Arun Prakash Jana
  8. lsblk
  9. echo
  10. echo -n "device (e.g. sdc2): "
  11. read dev
  12. if [ -z "$dev" ]; then
  13. exit 1
  14. fi
  15. echo
  16. if grep -qs "$dev " /proc/mounts; then
  17. sync
  18. pumount "$dev"
  19. if [ "$?" -eq "0" ]; then
  20. udisksctl power-off -b /dev/"$dev"
  21. echo $dev ejected.
  22. fi
  23. else
  24. pmount "$dev"
  25. echo "$dev" mounted to "$(lsblk -n /dev/"$dev" | rev | cut -d' ' -f1 | rev)".
  26. fi
  27. read dummy