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
Script not working..."sort" not working properly.... Rahulpict Shell Programming and Scripting 23 03-16-2009 11:13 AM
awk not working in script doitnow Shell Programming and Scripting 3 08-28-2008 06:36 AM
bdf script not working !! kpatel786 Shell Programming and Scripting 3 11-16-2007 11:10 AM
Pls. Help my script not working as it should cocoabeauty1 Shell Programming and Scripting 1 07-28-2007 05:11 PM
FTP script not working rookie250 Shell Programming and Scripting 2 12-19-2006 02:49 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 03-20-2009
wollop wollop is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 3
Script not working with SCO

Hi

In a script I have on a FreeBSD machine

[ $FILEA -nt $FILEB ] checks to see if FILEA is newer than FILEB

however on an SCO machine there isn't a -nt option.
Can anyone please tell me of an equivalent I can use?

Many thanks

Tony
  #2 (permalink)  
Old 03-20-2009
wempy's Avatar
wempy wempy is offline
Registered User
  
 

Join Date: Jun 2006
Location: Harpenden, UK
Posts: 208
both bash and ksh support -nt when comparing files, what shell are you using?
  #3 (permalink)  
Old 03-20-2009
wollop wollop is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 3
This is the script

#!/bin/sh

MONITORED_FILE=/root/temp

TEMP_FILE=/root/temp.1

[ ! -f $TEMP_FILE ] && touch -r $MONITORED_FILE $TEMP_FILE

if [ $MONITORED_FILE -nt $TEMP_FILE ]
then
ftp -i -n <<EOF
o 10.48.83.201
user ##### #######
cd vendor/cisco
put $MONITORED_FILE temp.txt
bye
EOF
fi

touch -r $MONITORED_FILE $TEMP_FILE

when run on SCO i get

# ./ftpscript
UX:test (./ftpscript): ERROR: -nt: Unknown operator
#

Looking on the man page doesn't show an -nt operator so now i'm stuck.
Any help or another way of doing the same thing would be of great help
thanks
  #4 (permalink)  
Old 03-20-2009
methyl methyl is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 1,167
If you have ksh, change the first line of the script.
  #5 (permalink)  
Old 03-20-2009
wollop wollop is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 3
Brilliant thanks
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 03:30 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