-   Linux - General (
-   -   Stupid Scripting Question (

steve_f60 03-10-2006 04:06 PM

Stupid Scripting Question
I am trying to write a simple bash script to replace the system.mwmrc with a modified one. There are currently 3 possible versions of system.mwmrc out there depending upon what type of terminal they have. We gave them a menu to select the terminal type depending upon their location in the store.

In the system.mwmrc there is a line that says :


depending on which terminal type it is.

My script will not work as I have written it :

#set -x
THIS=`grep pbyver /usr/X11R6/lib/X11/system.mwmrc | awk -F ":" '{print $2}'`

if [ $THIS = "RETAIL SETUP" ] ; then

echo "TADA"

exit 0

( Obvously the echo TADA is just to test the script. I expect the script to be a run once deal)

I keep getting messages about too many arguments in line 5 ( the if statement )

If I physically change the line in system.mwmrc to pby:RETAIL and change the if statement as well, it works. It appears that the script doesn't like the SPACES in the pbyver line. Is there anyway I can get this to work? Can I just fix on the first word somehow if need be?

I feel pretty stupid with this question....



pljvaldez 03-10-2006 04:08 PM

You can try putting quotes around "$THIS" in the if statement.

steve_f60 03-10-2006 04:21 PM

actually I think I mayy have found the issue, ......

an extra space at the end of the line when the initial system.mwmrc was written.

Thats what I get for " thinking " on a Fri afternoon.....

Keep moving folks...... Nothing to see here....

Thanks for the help !!!


All times are GMT -5. The time now is 01:07 PM.