Re: sounding system bell in a shell script run from toolbar icon
--- Shawn Lamson <madzimambo@yahoo.com> wrote:
> hey all -
>
> here's my question:
>
-----------------------snip
> busy etc... It works great when executed from a terminal window or
> xterm in X. But when i execute it via the menu/toolbar icon it won't
> sound the system bell ( i assume it has something to do with echo )
> ...
> so far the way i have found around this is to tell the icon to open
> an
> xterm window
-----------------------snip
now i am echoing a CTRL-G to a /tmp/sound$$ file and then catting it -
it works! But let me know if there is a better way that you know of.
PS. Yes - i also found utilities like "eject" "eject -t" and "cdchk"
to help out!
Thanks
> #----cut from $HOME/.icewm/menu
> #the first word "prog" means program ; CD is the title displayed ;
> #mounter is the name internal to Icewm and the rest is what is
> executed
>
> prog CD mounter xterm +ls -geom 5x3-0+0 -T '' -bg red -fg red -e
> /home/slamson/bin/mounter
>
> #prog CD mounter mounter
>
> #----end of cut
>
> the uncommented one opens the xterm and it functions fine - opening a
> "small" xterm and echoing a bell... the commented one works great
> too,
> but no system bell.
>
> How can i get the system bell to sound - you'll note i also use xset
> b
> to set duration etc at the bottom of the script - without opening a
> window to run this simple script?
>
>
> TIA - Shawn (script "mounter" follows)
>
>
>
> #!/bin/sh
> #shell program to mount / unmount cdrom drive
> #shawn lamson 06/24/2002
>
> set -x #uncomment for testing
>
> DEVICE=/dev/scd0
> MOUNT_PT=/cdrom
> STATUS=ON
> ERROR=' ERROR: mount or remount manually'
>
> #
> # this program could grep the fields of /etc/fstab to find
> devices but doesnt
> # it assumes /cdrom as mount point and my current device
> /dev/scd0
> #
>
> if ! grep "$MOUNT_PT" /etc/fstab
> then
> echo -e "Device $DEVICE is not set to mount in /etc/fstab\a"
> echo $ERROR
> exit 1
> fi
>
> if grep "$DEVICE" /etc/mtab
> then
> STATUS=ON
> else
> STATUS=OFF
> fi
>
> if [ $STATUS = ON ]
> then
> umount "$DEVICE" && cdcd open && echo -e "\a" && exit 0
> #
> # this will fail if device is busy
> # should drop down to echo bell
> #
>
> elif [ $STATUS = OFF ]
> then
> cdcd close
> mount /cdrom
> echo -e "\a" #indicate CD is ready
> exit 0
> else
> echo $ERROR
> echo "You may want to examine the output of #cat /etc/fstab"
> echo "and #cat /etc/mtab for clues"
> exit 1
> fi
> #
> #this bell will execute if all else fails - for example device
> $DEVICE
> is busy
> #
> echo "is device:$DEVICE busy?"
> xset b 100 700 1000 #set bell vol pitch duration
> echo -e "\a"
> xset b #sets bell back to defaults
> set +x #uncomment for testing
=====
Shawn Lamson
Debian/GNU Linux Woody
Kernel 2.2.19pre17
XFree86 Version 4.1.0.1 / X Window System
Jesus Loves You!
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
--
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Reply to: