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 > 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
Whats wrong in the script? nehagupta2008 UNIX for Dummies Questions & Answers 1 06-02-2008 06:24 AM
tell me whats wrong with this nadman123 Shell Programming and Scripting 1 04-14-2008 11:58 PM
tell me whats wrong in this? nadman123 Shell Programming and Scripting 1 04-10-2008 01:11 AM
Whats wrong with this script? kayarsenal Shell Programming and Scripting 2 08-25-2006 09:58 AM
whats wrong with this awk??? george_ Shell Programming and Scripting 5 04-04-2006 04:58 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-10-2006
dsravan dsravan is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 188
Whats wrong with the syntax

Whats wrong with below logic or syntax????

Quote:
if [ $file=$sourcefilepattern ] then
mv "$file" $arch
elseif [ $file=$targetfilepattern ] then
mv "$file" $targetarchive
fi

Last edited by dsravan; 08-10-2006 at 04:56 PM.. Reason: Overtyped one $
  #2 (permalink)  
Old 08-10-2006
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,119
a missing ';' after the ']' ?
I don't know - what's the error message?
  #3 (permalink)  
Old 08-10-2006
dsravan dsravan is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 188
Vgresh,

I added the below logic and it seems I am doing wrong by comparing 2 different file formats. Here the sourcefile pattern and targetfile pattern are different:

Quote:
for file do
if [[ "$file" = "$sourcefilepattern" ]] then
mv "$file" $arch
fi
if [[ "$file" = "$targetfilepattern" ]] then
mv "$file" $targetarchive
fi
Thanks any way
  #4 (permalink)  
Old 08-10-2006
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,119
once again, what exactly happens? any error messages?
  #5 (permalink)  
Old 08-10-2006
dsravan dsravan is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 188
Debug output:

Quote:
archive2.ksh AUD61_TLG DLY
+ export FILENAME=AUD61_TLG
+ export FILETYPE=DLY
+ arch=/biddf/ab6498/dev/ctl/arch
+ export arch
+ export STG_LOG_DIR=/edwstage/Logs
+ export targetarchive=/edwstage/Archive
+ [ DLY = DLY ]
+ export RUNDTFILE=audt_run_dt_dly.txt
+ cut -f2 -d:
+ grep OLD_DT /edwstage/Logs/audt_run_dt_dly.txt
+ export OLD_DT=20060601
+ cut -f2 -d:
+ grep NEW_DT /edwstage/Logs/audt_run_dt_dly.txt
+ export NEW_DT=20060701
+ cd /biddf/ab6498/dev/ctl
+ sourcefilepattern=AUD61_TLG_DLY_???_20060601.dat
+ targetfilepattern=AUD61_TLG_DLY_MKT_20060701.dat.new
+ [[ AUD61_TLG = AUD61_TLG_DLY_???_20060601.dat ]]
+ [[ AUD61_TLG = AUD61_TLG_DLY_MKT_20060701.dat.new ]]
+ [[ DLY = AUD61_TLG_DLY_???_20060601.dat ]]
+ [[ DLY = AUD61_TLG_DLY_MKT_20060701.dat.new ]]
+ targetfilepattern=AUD61_TLG_DLY_MKT_20060701.dat.new
+ mv AUD61_TLG_DLY_MKT_20060701.dat.new /edwstage/Archive
mv: AUD61_TLG_DLY_MKT_20060701.dat.new: cannot access: No such file or directory
+ cd /edwstage/Archive
+ compress /edwstage/Archive
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 08:38 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