kernol
Very Senior Member
The problem I see is unmounting a second USB drive while the first has the swap file. It'd be better to go through the swap files and remove any from the unmounted drive, something like
Code:tail -n+2 /proc/swaps | while read -r FILENAME _; do case "$FILENAME" in "$1/"*) swapoff "$FILENAME";; esac done
This is the code prior to the latest change made by Skynet ...
Code:
[ "$(/usr/bin/find $1/myswap.swp 2> /dev/null)" ] && swapoff $1/myswap.swp # Added by Diversion