The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Learning Oracle ADF: A Beginner's Story iBot Oracle Updates (RSS) 0 04-06-2008 06:10 AM
what is wrong with this script? rs1969 UNIX for Dummies Questions & Answers 2 11-15-2007 07:16 AM
A beginner's problem kira_freedom High Level Programming 2 09-30-2005 03:06 AM
something wrong with this script?? fusion76 Shell Programming and Scripting 2 02-01-2005 01:24 AM
what is wrong with this script? circleW Shell Programming and Scripting 2 09-28-2004 09:27 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-16-2008
pallak7 pallak7 is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 19
What's wrong here? (Beginner's script)

Hi Folks,

New member here. I have been using UNIX systems for the past ~4 years (Linux, AIX, HP-UX, mostly) but have never had the need to write a script for myself. Now, things have changed and I'm in a bit of a pickle. I have, what looks to me like a syntactically correct script that's not quite working exactly as I'd hoped. It's for the BASH shell. Here's where it's failing:

Code:
i=0
while [ $i -lt $count ]
do
  trap "ctrlc" SIGINT SIGTERM
  if [ "$i" -eq 0 ]; then
    date > new && ps -o user,pid,command | grep $PATTERN | grep -v ps >> new
    cat new
  else
    mv new old
    date > new && ps -o user,pid,command | grep $PATTERN | grep -v ps >> new
    diffProc()
  fi
  i=$(($i+1))
  echo
  sleep 10
done
The error I'm getting is:
Quote:
line 62: syntax error near unexpected token `fi'
line 62: ` fi'
Line 62 is the 'fi' following the call to diffProc(). I've looked at several BASH tutorials and the if statement here seems to be well-formed. I've turned on debugging but that doesn't really say much more than the error, except for the values of some variables. Any assistance you could give me would be greatly appreciated. Thank you.
  #2 (permalink)  
Old 02-16-2008
matrixmadhan matrixmadhan is offline Forum Advisor  
Technorati Master
  
 

Join Date: Mar 2005
Location: leaf node in B+ tree
Posts: 2,957
diffProc is a function call.

Just call it as
Code:
diffProc
and not as

diffProc()
  #3 (permalink)  
Old 02-16-2008
pallak7 pallak7 is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 19
I knew it had to be something stupid like that. Thanks, matrixmadhan. My Java background definitely came into play there.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:17 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0