I miss the syntax to make the last statement work.
Hi,
This shell function is a prototype.
Test() { \
workingVolume=40d81969-8f9d-4964-b214-87bcf273192a
echo "working volume asigned a value; now try blkid."
if ! blkid -t UUID="$workingVolume" > /dev/null; then
printf "workingVolume not found.\n"
else
printf "workingVolume found.\n"
fi
echo "Now try to catch the name of the device."
blkid -t UUID="$workingVolume" | cut -d':'
}
The if statement gives the result I expect.
I miss the syntax to make the last statement work.
It looks like what you were trying for was cut -d: -f1
In addiction I'd suggest to use the so called "exit status variable: $?" in the "if ; then" statement:
...
echo "working volume assigned a value; now try blkid."
blkid -t UUID="$workingVolume" >/dev/null 2>&1
if [ $? -ne 0 ] ; then
printf "workingVolume not found.\n"
else
...
it makes the code more readable, IMHO.
| Sysop: | Jacob Catayoc |
|---|---|
| Location: | Pasay City, Metro Manila, Philippines |
| Users: | 4 |
| Nodes: | 4 (0 / 4) |
| Uptime: | 497100:10:24 |
| Calls: | 182 |
| Files: | 744 |
| D/L today: |
16 files (5,383K bytes) |
| Messages: | 73,587 |