Date: Tue, 26 Aug 2003 15:00:23 -0500 From: "Charles Howse" <chowse@charter.net> To: <questions@freebsd.org> Subject: RE: Detect floppy diskette Message-ID: <002a01c36c0c$af801500$04fea8c0@moe> In-Reply-To: <20030826160456.GD11087@webserver>
next in thread | previous in thread | raw e-mail | index | archive | help
> Try this:
> % perl
> use POSIX qw/:fcntl_h dup2 setsid/;
> if (fork) { exit; }
> setsid;
>=20
> my $fd =3D POSIX::open "/dev/null", O_WRONLY or die "Can't open=20
> /dev/null: $!\n";
> dup2 $fd, 0;
> dup2 $fd, 1;
> dup2 $fd, 2;
>=20
> sleep 5;
>=20
> system "sudo mount /dev/fd0 /mnt";
>=20
> % # wait for an error within 5 seconds or so
>=20
> If no error appears, I think you forgot the / on /dev/null up=20
> there :-) Make
> sure to unmount the floppy afterwards.
> If there is an error, it proves that it was/is a kernel message.
Looks good, now...I have to insert this perl code into a bash script as
a function.
This generates a syntax error:
#!/usr/local/bin/bash
Chkflp(){
/usr/bin/perl
use POSIX qw/:fcntl_h dup2 setsid/;
if (fork) { exit; }
setsid;
=20
my $fd =3D POSIX::open "/dev/null", O_WRONLY or die "Can't open=20
/dev/null: $!\n";
dup2 $fd, 0;
dup2 $fd, 1;
dup2 $fd, 2;
=20
sleep 5;
}
<remainder of bash script>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?002a01c36c0c$af801500$04fea8c0>
