UUID confusion revisited

SYNass IT Ubuntu / Linux i-ubux at synass.net
Tue Mar 25 09:54:25 UTC 2008


Hi Nils, thanks for your feedback and help:

On Tue, 2008-03-25 at 09:49 +0100, Nils Kassube wrote:
> SYNass IT Ubuntu / Linux wrote:
> > a1) I assume $HOME/bin means /home/bin !?
> 
> No, "$HOME" is the shell variable which points to your home directory. As 
> I don't know which your login is, I used this variable. If your login 
> is "svobi", the shell would expand "$HOME/bin" to "/home/svobi/bin".
> 
> > a2) I do not have such a location ! ;-(
> 
> If the directory doesn't exist, make it with a GUI file manager or in a 
> terminal with the command "mkdir $HOME/bin".

OK, no problem !
I prefer your other recommendation to have it available for all users, 
just me and root !! ;-)


> > b1) Created my script (UUIDcomp) in /usr/local/bin
> > b2) After chmod +w /usr/local/bin/UUIDcomp I am getting:
> >
> > sna at WS222:~$ sh UUIDcomp
> > sh: Can't open UUIDcomp
> >
> > sna at WS222:~$ UUIDcomp
> > bash: /usr/local/bin/UUIDcomp: Permission denied
> > sna at WS222:~$
> >
> > What and where could have gone wrong ...
> > ... or where did I make my mistake/s ??
> 
> Sorry, that was my mistake, not yours (I think I need some coffee).

OK and again, No problem !
The needed coffee would be on me !! ;-)


> The chmod command really should have been this:
> 
> sudo chmod +x /usr/local/bin/UUIDcomp
> 
> With the +w option you made it writeable but the +x option makes it executable.

I assumed something to do with +w = write and already checked the
permissions but 
forgot to tell it in my previous answer but I would have been unable to
solve it ! ;-((

Now it works !
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 !!

My working modification looks like following:

#!/bin/sh
# 
ls -l /dev/disk/by-uuid/ |\
awk '{print $10, "UUID="$8}' | sort |\
awk -F"/" '{print $3}' > $HOME/Desktop/UUIDcomp_Drives.$(date '+%y%m%d_%
H%M%S')
#
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\///' > $HOME/Desktop/UUIDcomp_Mounts.$(date '+%y%m%d_%H
%M%S')
#
join -a 1 $HOME/Desktop/UUIDcomp_Drives.$(date '+%y%m%d_%H%M%S')
$HOME/Desktop/UUIDcomp_Mounts.$(date '+%y%m%d_%H%M%S')

Any better suggestion available ?

However, once again thanks a lot for your appreciated help and 
cheers, svobi





More information about the ubuntu-users mailing list