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
Taking CEP to The Next Step iBot Complex Event Processing RSS News 0 02-29-2008 06:40 PM
Step by step Installation of Unix SCO 2.1 nensee7 UNIX for Dummies Questions & Answers 0 01-11-2007 09:22 AM
Next Step?? (Different Forum) Pls. help radith SuSE 1 09-04-2004 09:19 AM
install of sco unix step by step porikamu UNIX for Dummies Questions & Answers 1 05-27-2004 09:46 AM
Step by Step Script lisafern UNIX for Dummies Questions & Answers 14 11-18-2003 07:19 PM

 
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
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 12-06-2007
whamchaxed whamchaxed is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 7
works step by step on command line but not in script

Hi all,
The following script is fine when I work via command line

HTML Code:
m=1
c=0
while [ $c = 0 ]
do
echo $m
gnokii --getsms IN $m > out.txt;
m=`expr $m + 1`;
cat out.txt >> message_log;
############
read first crap< <(sed -n '/Text:/{n;p;}' out.txt);
read message< <(sed -n '/Text:/{n;p;}' out.txt);
if [ $first != "02" ]; then
cat out.txt
fi
#############
SIZE=`wc -c out.txt | tr -d ' out.txt'`
if [ $SIZE == 0 ]; then 
echo 'time to exit';
c=`expr $c + 1`;
fi  
done
but when run via a shell script I get the error message:

HTML Code:
/usr/local/bin/mc_smsread.sh: line 18: syntax error near unexpected token `<'
/usr/local/bin/mc_smsread.sh: line 18: `read first crap< <(sed -n '/Text:/{n;p;}' out.txt);'
Why does it work on command line but not within the loop?

Here is an example out.txt file that is written and used:

HTML Code:
1. Inbox Message (read)
Date/time: 30/11/2007 18:17:03 
Sender: O2-UK Msg Center: +447802000332
Text:
O2 Rewards: Get rewarded with 10% back on all your top-ups - simply text REWARD to 50202 free to join. Call 313 opt. 4 free for info & terms. Stop SMS call 2220
Any help gratefully received,

Adam
 

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 07:53 AM.


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