The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Perl cgi script to call bash script? pleonard Shell Programming and Scripting 0 06-02-2009 01:57 PM
Bash script: issue changing directories in script Breakology Shell Programming and Scripting 5 05-26-2009 08:47 AM
how to make your bash script run on a machine with csh and bash npatwardhan Shell Programming and Scripting 3 11-19-2008 04:17 AM
passing variable from bash to perl from bash script arsidh Shell Programming and Scripting 10 06-04-2008 12:25 PM
Why generate "ash and bash" different output for same bash script? s. murat Shell Programming and Scripting 0 05-26-2008 07:19 AM

 
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 06-22-2009
Ruzeil Ruzeil is offline
Registered User
  
 

Join Date: Feb 2009
Posts: 7
script in Bash 2.05b.0(1) and 3.2.25(1) Red Hat

Hi
I have this script

#!/bin/bash
cat status.txt | while read LINE
do
linija="$LINE"
echo $linija
echo $linija | awk '{print $1}' > temp.txt
koj=`tail -1 temp.txt`
echo $koj
echo $linija | awk '{print $2}' > temp1.txt
kolku=`tail -1 temp1.txt`
vkupno=$(( vkupno + kolku ))
echo $kolku
echo $vkupno > vkupno_temp.txt
done
kolku_vkupno=`tail -1 vkupno_temp.txt`
echo $kolku_vkupno

and its working perfectly in 2.05b.0(1) bash called with ksh and bash
But in 3.2.25(1) version of bash only the first line of status.txt passes. Then (on the second line of the file status.txt) i get this error : arithmetic syntax error
on this line vkupno=$(( vkupno + kolku )). Can someone pls help. What should i change in the script to work in new bash.

Thanks in advance

P.S. status.txt consists of lines :
sometext 4
another text 12
and so on
 

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 03:46 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