* [gentoo-user] what is wrong with script
@ 2005-08-30 14:41 bshlists
2005-08-30 14:54 ` Christoph Gysin
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: bshlists @ 2005-08-30 14:41 UTC (permalink / raw
To: gentoo-user
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [gentoo-user] what is wrong with script
2005-08-30 14:41 [gentoo-user] what is wrong with script bshlists
@ 2005-08-30 14:54 ` Christoph Gysin
2005-08-30 16:46 ` Matt Randolph
2005-08-31 1:55 ` Alvin A ONeal Jr
2 siblings, 0 replies; 4+ messages in thread
From: Christoph Gysin @ 2005-08-30 14:54 UTC (permalink / raw
To: gentoo-user; +Cc: bshlists
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" org@fr33z3
--
gentoo-user@gentoo.org mailing list
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [gentoo-user] what is wrong with script
2005-08-30 14:41 [gentoo-user] what is wrong with script bshlists
2005-08-30 14:54 ` Christoph Gysin
@ 2005-08-30 16:46 ` Matt Randolph
2005-08-31 1:55 ` Alvin A ONeal Jr
2 siblings, 0 replies; 4+ messages in thread
From: Matt Randolph @ 2005-08-30 16:46 UTC (permalink / raw
To: gentoo-user
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [gentoo-user] what is wrong with script
2005-08-30 14:41 [gentoo-user] what is wrong with script bshlists
2005-08-30 14:54 ` Christoph Gysin
2005-08-30 16:46 ` Matt Randolph
@ 2005-08-31 1:55 ` Alvin A ONeal Jr
2 siblings, 0 replies; 4+ messages in thread
From: Alvin A ONeal Jr @ 2005-08-31 1:55 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 526 bytes --]
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)
[-- Attachment #2: coolaj86.vcf --]
[-- Type: text/x-vcard, Size: 323 bytes --]
begin:vcard
fn:Alvin A ONeal Jr
n:ONeal;Alvin
adr;dom:;;34 Fletcher Lane;Shelburne;VT;05482
email;internet:coolaj86@havenite.net
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-08-31 2:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-30 14:41 [gentoo-user] what is wrong with script bshlists
2005-08-30 14:54 ` Christoph Gysin
2005-08-30 16:46 ` Matt Randolph
2005-08-31 1:55 ` Alvin A ONeal Jr
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox