UUID confusion revisited

SYNass IT Ubuntu / Linux i-ubux at synass.net
Tue Mar 25 12:18:48 UTC 2008


WOW, Nils, perfect !
Are you capable of mindreading ?


On Tue, 2008-03-25 at 12:30 +0100, Nils Kassube wrote:
> SYNass IT Ubuntu / Linux wrote:
> > Unfortunately partial only: It displays on the screen but the two
> > individual files UUIDcom_Drives.ymmdd_HHMMSS &
> > UUIDcomp_Mounts.ymmdd_HHMMSS are no more on the Desktop now !!
> 
> It looks as if there are spaces in your filenames, but maybe that is
> a fault of our email programs. If there are spaces in the filenames,
> they must be quoted, or even better, avoid spaces in filenames.

OK, there were NO spaces !
In the first try the 2 files went to my home directory !
In the second try I got it to the Desktop !!
In the third try, with spaces between UUIDcomp and Drives or Mounts ...
... it failed !!! ;-)

 
> Furthermore there could be a problem with the file names because the
> date command is run several times. Then maybe the time is different
> from the first to the last date command.

You are correct ! Logo, this may always happen when time is just
changing in the 
moment of processing these 2 steps !


> You could try this (untested) modified version:
> 
> #!/bin/sh
> d="$(date '+%y%m%d_%H%M%S')"
> Dr="$HOME/Desktop/UUIDcomp_Drives.$d"
> Mo="$HOME/Desktop/UUIDcomp_Mounts.$d"
> ls -l /dev/disk/by-uuid/ |\
> awk '{print $10, "UUID="$8}' | sort |\
> awk -F"/" '{print $3}' > "$Dr"
> cat /etc/fstab |\
> sed -e '/.*\/dev.*$/N;s/\n */ /' |\
> sed -e 's;^# *;;' |\
> sed -e 's/\(^\/dev\/[a-z0-9]* UUID=[a-z0-9]\{8\}-[a-z0-9]\{4\}-[a-z0-9]\{4\}-[a-z0-9]\{4\}-[a-z0-9]\{12\}\).*/\1/' |\
> sed -e '/^\/dev\/.*UUID.*/!d' |\
> sed -e 's/^\/dev\///' > "$Mo"
> join -a 1 "$Dr" "$Mo"
> 
> Hopefully, I got that km long line correct :)

NOPE !!!
You didn't got it correct !!
You got it perfect ! ;-D

You are really capable mindreader:
Again I was thinking of "parms" too ...
... but not capable to get the idea realized ! ;-)

I like your perfect solution and it works correctly !!

Cool, thanks a lot and cheers, svobi





More information about the ubuntu-users mailing list