LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   Stupid Scripting Question (http://www.linuxquestions.org/questions/linux-general-1/stupid-scripting-question-423609/)

steve_f60 03-10-2006 03: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 :

!pbyver: RETAIL SETUP
or
!pbyver: SERVICE SETUP

depending on which terminal type it is.

My script will not work as I have written it :

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

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

echo "TADA"
fi

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....

Thanks,

Steve

pljvaldez 03-10-2006 03:08 PM

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

steve_f60 03-10-2006 03: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 !!!

Steve


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