Usando find
e awk
#!/bin/bash
# your code ...
# The name of your MAXimum 1 drive in /media/$USER
maximum1="MAXimum 1"
if [ -z "$(find /media/$USER/ -maxdepth 1 ! -path /media/$USER/ -type d |\
awk '! /'"$maximum1"'/')" ]
then
echo "Hey, the only USB device is $maximum1"
else
echo "Hey, no USB pendrive in my I/O."
fi
# your code ...
Exemplo
% ls -laog /media/$USER
total 24
drwxr-x---+ 3 4096 Aug 20 15:16 .
drwxr-xr-x 5 4096 Aug 18 08:43 ..
drwxr-xr-x 8 16384 Jan 1 1970 STORE N GO
% maximum1="STORE N GO"; if [ -z "$(find /media/$USER/ -maxdepth 1 ! -path /media/$USER/ -type d | awk '! /'"$maximum1"'/')" ]; then echo "Hey, the only USB device is $maximum1"; else echo "Hey, no USB pendrive in my I/O."; fi
Hey, the only USB device is STORE N GO
% maximum1="NOT STORE N GO"; if [ -z "$(find /media/$USER/ -maxdepth 1 ! -path /media/$USER/ -type d | awk '! /'"$maximum1"'/')" ]; then echo "Hey, the only USB device is $maximum1"; else echo "Hey, no USB pendrive in my I/O."; fi
Hey, no USB pendrive in my I/O.