Question about bash wrapper script

Berry, Randall randyn3lrx at
Sun May 2 08:52:57 UTC 2010

  I have an application I am working on that requires a config file in 
the users home directory. This file is .asoundrc (alsa sound config) I 
need to write a script that does 5 things.

  1 ) check if the file is installed already (go to step 2 else go to 
step 3)
  2 ) install the file if it is not there (go to step 4)
  3 ) Open the file and check for parameters. (go to step 4 else go to 
step 5)
  4 ) If parameters are missing then append them to the file. (go to step 5)
  5 ) If all checks out launch the application (end)

  I've gotten all but step 3 and step 4 to work so far but I don't know 
how to tell bash to check for the needed parameters in an existing file 
and if not there append them. I don't want to just open for append 
because then it will just create a massive file over time as they are 
added each time the program is run and I don't want to overwrite the 
users file if it already exists, thus breaking something else the user 
may have installed.

  Also, is there a way to check the users sound device? I have it hard 
coded right now for sound device 0. It would be nice if it could prompt 
for device number in case the user has more than one device or if for 
some other reason the device number is not 0.

  Hopefully this makes sense to someone it's hard getting these thoughts 
from inside my gray matter to paper.


More information about the devel mailing list