:: Re: [DNG] findUUID?
Top Page
Delete this message
Reply to this message
Author: peter
Date:  
To: dng
Subject: Re: [DNG] findUUID?
From:    Didier Kryn <kryn@???>
Date:    Thu, 18 Dec 2025 11:17:07 +0100

> lsblk -o NAME,UUID


Then check for a specific device.
if (lsblk -o UUID | grep "40d81969-8f9d-4964-b214-87bcf273192a" | wc -c)=37 ; then
echo device present
else
echo device not present
fi

The if condition has 3 commands, lsblk, grep and wc. I'm working on
something more direct.

The findmnt manual has this under EXIT STATUS.
The exit value is 0 if there is something to display, or 1 on any
error (for example if no filesystem is found based on the user's
filter specification, or the device path or mountpoint does not
exist).

if [ findmnt -nrS UUID=$workingVolume ]; then
echo "$workingVolume is not mounted"
else
echo "$workingVolume is mounted"
fi

The if condition has a syntax error. Can someone suggest a fix?

From:    Didier Kryn <kryn@???>
Date:    Thu, 18 Dec 2025 11:57:31 +0100

> ... RTFM (~:


I'm aware of manuals and the old RTFM cliche. The implicit types in
bash tend to confuse me. In this instance, I don't know which manual
might help.

Thx,                         ... P.





-- 
mobile:  +1 778 951 5147 <= still working
VoIP:    +1 778 508 0020 <= new & working
projects: en.wikibooks.org/wiki/User:PeterEasthope