LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-10-2006, 03:06 PM   #1
steve_f60
Member
 
Registered: Jul 2004
Posts: 43

Rep: Reputation: 15
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
 
Old 03-10-2006, 03:08 PM   #2
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 281Reputation: 281Reputation: 281
You can try putting quotes around "$THIS" in the if statement.
 
Old 03-10-2006, 03:21 PM   #3
steve_f60
Member
 
Registered: Jul 2004
Posts: 43

Original Poster
Rep: Reputation: 15
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Stupid, stupid question; I lost Klaptop. :( Surfrider Slackware 2 08-31-2005 09:12 PM
Stupid Dumb Stupid Question... drigz Linux - Software 3 09-23-2004 03:09 PM
Really stupid question...but.. Kyral Retsam Slackware 6 07-18-2004 05:37 PM
Very Stupid question... dlucas10 Linux - General 1 10-30-2003 07:01 PM
Linux Scripting stupid question linuxsucks Programming 1 08-05-2003 11:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:59 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration