LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-08-2005, 04:17 AM   #1
loopoo
Member
 
Registered: Aug 2005
Posts: 40

Rep: Reputation: 15
'test' error


Hi!

I have this lines in my script:

myvar=`dataload.sh $1 $2 $3 $log` ;

if test $myvar -eq 1
then
./script.sh
fi


and I get this error message:

./launch.sh: line 35: test: too many arguments


In 'dataload.sh', myvar appears twice:

myvar=0;

while ..
do
..
myvar=1 ;
done


and it is echoed at the end of the file to be recieved in the first script
echo $myvar;

What coud be wrong in my script?


Thanks in advance,
LooPoo
 
Old 08-08-2005, 05:18 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
i'd guess that myvar is not a single digit. so...

1) echo out the value of myvar, inside this script before you test it. prove what's actually been recieved from the second script.

2) use [ ] notation instead of "test": if [ $myvar -eq 1 ] ... neater...
 
Old 08-08-2005, 05:26 AM   #3
loopoo
Member
 
Registered: Aug 2005
Posts: 40

Original Poster
Rep: Reputation: 15
thanks for your suggestion

I've already done that and I'm not recieving the right value, even though it a single digit (used as boolean - 0 or 1)

I'm searching the problem somewhere else now
 
Old 08-08-2005, 08:00 AM   #4
heema
Senior Member
 
Registered: Sep 2003
Location: Egypt
Distribution: Arch
Posts: 1,528

Rep: Reputation: 47
try putting double quotes around $myvar

Code:
if test "$myvar" -eq 1
then
./script.sh
fi
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Silly error: If test condition shalomajay Programming 3 10-31-2005 04:57 PM
500 internal error when running test.pl shizzle Linux - Networking 1 05-19-2005 07:39 AM
How to test for hardware disk error? Yalla-One Linux - Hardware 12 03-11-2005 03:58 AM
now getting error in coreutils test(chapter 6-lfs-5.1.1) linuxbh Linux From Scratch 2 09-16-2004 03:45 AM
same error message in every 2.6 test kernel apberzerk Linux - General 3 11-01-2003 07:16 PM


All times are GMT -5. The time now is 09:41 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration