Re: Difficulty with a shell function.
- To: debian-user@lists.debian.org
- Subject: Re: Difficulty with a shell function.
- From: Kamil Jońca <kjonca@o2.pl>
- Date: Sun, 25 Jan 2026 10:59:07 +0100
- Message-id: <[🔎] 878qdmypw4.fsf@alfa.kjonca>
- In-reply-to: <Mh10R-d9sv-1@gated-at.bofh.it> (peter@easthope.ca's message of "Sun, 25 Jan 2026 06:40:01 +0100")
- References: <Mh10R-d9sv-1@gated-at.bofh.it>
peter@easthope.ca writes:
> # blkid --uuid 2026-01-19-03-28-45-00
> /dev/sdc
Is this a real uuid or redacted one? Its syntax is strange for me.
> Meaning that the block device with that UUID is connected to the system.
>
> When this executes,
>
> destination="2026-01-19-03-28-45-00";
> printf "destination=$destination\n";
> if ! ( lsblk -alno UUID | grep $destination > /dev/null ); then
> printf "destination device not connected. Aborting.\n"
> else
> printf "destination device is connected.\n"
> dev="$( blkid --uuid $destination )";
> printf "dev=$dev\n";
> # FTH;
> fi;
>
> this is the output.
> destination=2026-01-19-03-28-45-00
> destination device not connected. Aborting.
>
> With the device being present, I expect this.
> destination=2026-01-19-03-28-45-00
> destination device is connected.
> dev=/dev/sdc
>
> Does this line have a syntax error?
> if ! ( lsblk -alno UUID | grep $destination > /dev/null ); then
>
> Thanks, ... P.
what returns:
destination="2026-01-19-03-28-45-00";
lsblk -alno UUID | grep $destination
?
KJ
--
http://wolnelektury.pl/wesprzyj/teraz/
EMACS = Each Manual's Audience is Completely Stupified
Reply to: