Philip Creevy wrote:
> cat returns pico:x:502:bob
> ls -l of /dev/bus/usb/001/009 returns
> crw-rw---- 1 root pico 189, 8 Apr 29 22:08 /dev/bus/usb/001/009
>> A script is checking that the user is in the pico group with
>> username=$(id -un)
> usergroups=$(id -Gn) id -Gn returns bob at the command line
>> # Determine whether the user is in the group of the file
> grouptest=$(echo \ $usergroups\ | sed "s/.*\ \($group\)\ .*/\1/")
>> I'am not a sed person so I would not know if the above is correct or not
> but it does work when logged in as root
>
Do you mean the script works when you are logged in as root or just the
line when you test it on the command line?
Your line seems to be ok, at least with the following test:
--
[@joe:~]$ export TEST=`id -Gn |sed "s/.*\ \(audio\)\ .*/\1/"`; echo $TEST
audio
[@joe:~]$
--
You can add on the beginning of the bash script (if it's bash) the
following :
set -xv
That gives you some more details when the script runs.
cya,
Christian
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!