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
combining two lines in Linux script yshahiac Linux 4 08-24-2008 12:59 AM
Script works on Solaris, not on Linux Silverhood Shell Programming and Scripting 0 10-05-2007 10:27 AM
Linux Server Monitoring Script !!! csaha Shell Programming and Scripting 4 12-23-2005 12:48 AM
Script Migration From HP to Linux (KSH) Omkumar Shell Programming and Scripting 1 09-02-2005 10:44 AM
Linux Os Crash Script cstovall Shell Programming and Scripting 1 07-09-2004 03:19 AM

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 04-15-2008
Dastard Dastard is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 47
Arrow Linux Script help

Hi Everyone , have a nice day
given below is a simple linux script
but its first part is not working ( variable k assignment ) , while second loop is working fine
can anyone help me out with this

HTML Code:
#!/bin/sh
echo "Enter Date"
read date1
for i in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23
do
k = `grep -i success /var/seamless/spool/tdr/ERS_200804$date1$i* | wc -l`
echo $k
done
echo "                "
for i in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23
do
grep -i fail /var/seamless/spool/tdr/ERS_200804$date1$i* | wc -l
done
Thanks in Anticipation
  #2 (permalink)  
Old 04-15-2008
aahhhchoooo aahhhchoooo is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 1
Quote:
Originally Posted by Dastard View Post
Hi Everyone , have a nice day
given below is a simple linux script
but its first part is not working ( variable k assignment ) , while second loop is working fine
can anyone help me out with this

HTML Code:
#!/bin/sh
echo "Enter Date"
read date1
for i in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23
do
k = `grep -i success /var/seamless/spool/tdr/ERS_200804$date1$i* | wc -l`
echo $k
done
echo "                "
for i in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23
do
grep -i fail /var/seamless/spool/tdr/ERS_200804$date1$i* | wc -l
done
Thanks in Anticipation

Remove the spaces surrounding the = when you assign the variable k. It should read
k=`grep -i....`

Remember you can put a "-x" at the end of your #!/bin/sh statement and it will run the script in debug
  #3 (permalink)  
Old 04-15-2008
Dastard Dastard is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 47
Arrow

HTML Code:
k =`grep -i success /var/seamless/spool/tdr/ERS_200804$date1$i* | wc -l`
echo $k
done
i have added -x for debug , not it is calculating value of k , but its not echoing it , what could possibly be wrong with echo $k
  #4 (permalink)  
Old 04-15-2008
DukeNuke2's Avatar
DukeNuke2 DukeNuke2 is online now Forum Staff  
Soulman
  
 

Join Date: Jul 2006
Location: Germany, Berlin
Posts: 2,987
Quote:
Originally Posted by Dastard View Post
HTML Code:
k =`grep -i success /var/seamless/spool/tdr/ERS_200804$date1$i* | wc -l`
echo $k
done
i have added -x for debug , not it is calculating value of k , but its not echoing it , what could possibly be wrong with echo $k
remove the space as allready suggested before...

Code:
k=`your code`
  #5 (permalink)  
Old 04-15-2008
Dastard Dastard is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 47
Talking

Worked
Thanks a bunch
  #6 (permalink)  
Old 04-15-2008
xNaTe128x xNaTe128x is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 2
cp file1 file2 script help, immediate help needed......

Do you know how to make up the script "cp file1 file2"? If you don't know, do you know of anyone else that could help me? I need a response as soon as possible, I greatly appreciate any help you can give me.
  #7 (permalink)  
Old 04-15-2008
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,125
Quote:
Originally Posted by xNaTe128x View Post
Do you know how to make up the script "cp file1 file2"? If you don't know, do you know of anyone else that could help me? I need a response as soon as possible, I greatly appreciate any help you can give me.
Pls don't 'hijack' other people's threads - start a new thread.
Read the Rules of these forums FIRST.
Closed Thread

Bookmarks

Tags
linux

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 08:16 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