[gentoo-user] what is wrong with script

2005-08-30 Thread bshlists
I've been trying run this script on my gentoo laptop, but for some reason it 
does not work.  If you see what is wrong could you email me.  Thanks.

#!/bin/bash

if [ ${ACTION} = add ]  [ -f ${DEVICE} ]
then
rmmod garmin_gps
chmod 666 $DEVICE
fi

-- 
DWW
-- 
gentoo-user@gentoo.org mailing list



Re: [gentoo-user] what is wrong with script

2005-08-30 Thread Christoph Gysin

bshlists wrote:
I've been trying run this script on my gentoo laptop, but for some reason it 
does not work.  If you see what is wrong could you email me.  Thanks.


#!/bin/bash

if [ ${ACTION} = add ]  [ -f ${DEVICE} ]
then
rmmod garmin_gps
chmod 666 $DEVICE
fi



$ man test

   -f FILE
  FILE exists and is a regular file


I don't know the garmin_gps module and its devices, but I assume $DEVICE is a 
character device. So the test should be:


...  [ -c ${DEVICE} ]

Christoph
--
echo mailto: NOSPAM !#$.'*'|sed 's. ..'|tr * !#:2 [EMAIL PROTECTED]
--
gentoo-user@gentoo.org mailing list



Re: [gentoo-user] what is wrong with script

2005-08-30 Thread Matt Randolph
Have a look at the comp.unix.shell newsgroup.  There are some insanely 
talented people in there dispensing free advice.


bshlists wrote:

I've been trying run this script on my gentoo laptop, but for some reason it 
does not work.  If you see what is wrong could you email me.  Thanks.


#!/bin/bash

if [ ${ACTION} = add ]  [ -f ${DEVICE} ]
then
   rmmod garmin_gps
   chmod 666 $DEVICE
fi

 




--
Pluralitas non est ponenda sine necessitate - W. of O.

--
gentoo-user@gentoo.org mailing list



Re: [gentoo-user] what is wrong with script

2005-08-30 Thread Alvin A ONeal Jr
From the looks of the script you aren't testing for a regular file, 
hence -f doesn't work.




I tested it on my machine

WORKS:
 ACTION=add
 DEVICE=/tmp/testfile

DOESN'T WORK:
 ACTION=add
 DEVICE=/dev/sda1

SCRIPT:
 #!/bin/bash
 if [ ${ACTION} == add ]  [ -f ${DEVICE} ]; then
 echo SUCCESS
 fi


--
8^)
Laterz-
~Alvin
http://CoolAJ86.Havenite.net

---
Gentoo makes easy things difficult, impossible things easy, but it also 
gives you enough rope to hang yourself. ~ swegener (Sven Wegener)
begin:vcard
fn:Alvin A ONeal Jr
n:ONeal;Alvin
adr;dom:;;34 Fletcher Lane;Shelburne;VT;05482
email;internet:[EMAIL PROTECTED]
tel;work:1.802.877.2938
tel;home:1.802.985.5277
tel;cell:1.802.578.0599
note;quoted-printable:DoB: 19860616=0D=0A=
	
x-mozilla-html:FALSE
url:http://coolaj86.havenite.net
version:2.1
end:vcard