My build of nnn with minor changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

nmount 833 B

5 vuotta sitten
5 vuotta sitten
1234567891011121314151617181920212223242526272829303132333435
  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. while ! [ -z "$dev" ]
  13. do
  14. if grep -qs "$dev " /proc/mounts; then
  15. sync
  16. pumount "$dev"
  17. if [ "$?" -eq "0" ]; then
  18. echo "$dev" unmounted.
  19. udisksctl power-off -b /dev/"$dev"
  20. if [ "$?" -eq "0" ]; then
  21. echo "$dev" ejected.
  22. fi
  23. fi
  24. else
  25. pmount "$dev"
  26. echo "$dev" mounted to "$(lsblk -n /dev/"$dev" | rev | cut -d' ' -f1 | rev)".
  27. fi
  28. echo
  29. echo -n "next device: "
  30. read dev
  31. done