Script not working with SCO


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script not working with SCO
# 1  
Old 03-20-2009
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  
Old 03-20-2009
both bash and ksh support -nt when comparing files, what shell are you using?
# 3  
Old 03-20-2009
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  
Old 03-20-2009
If you have ksh, change the first line of the script.
# 5  
Old 03-20-2009
Brilliant thanks
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with speeding up my working script to take less time - how to use more CPU usage for a script

Hello experts, we have input files with 700K lines each (one generated for every hour). and we need to convert them as below and move them to another directory once. Sample INPUT:- # cat test1 1559205600000,8474,NormalizedPortInfo,PctDiscards,0.0,Interface,BG-CTA-AX1.test.com,Vl111... (7 Replies)
Discussion started by: prvnrk
7 Replies

2. Shell Programming and Scripting

expect script inside shell script not working.

Shell Scipt: temp.sh su - <$username> expect pass.exp Expect script: pass.exp #!/usr/bin/expect -f # Login ####################### expect "Password: " send "<$password>\r" it comes up with Password: but doesnt take password passed throguh file. (2 Replies)
Discussion started by: bhavesh.sapra
2 Replies

3. Shell Programming and Scripting

Script not working in cron but working fine manually

Help. My script is working fine when executed manually but the cron seems not to catch up the command when registered. The script is as follow: #!/bin/sh for file in file_1.txt file_2.txt file_3.txt do awk '{ print "0" }' $file > tmp.tmp mv tmp.tmp $file done And the cron... (2 Replies)
Discussion started by: jasperux
2 Replies

4. SCO

SCO UNIX ftp - weird kind of working

hi, i am working on sco unix 5.07, i have 10 individual servers networked locally in which sco os is installed. one of them is not transferring the file to other servers but accepting all files. means Server (A) can accept the file through FTP from any server but not transferring FTP its own... (9 Replies)
Discussion started by: aafflatoon
9 Replies

5. Shell Programming and Scripting

Script is not working from cron while working manually

Hello, I am facing a very strange problem when I run my script manuallu ./Fetchcode which is using to connect with MKS integrity from linux end it workks fine but when I run it from cron it doesn't work.Can someone help me 1) How could I check my script when it is running from cron like... (3 Replies)
Discussion started by: anuragpgtgerman
3 Replies

6. Shell Programming and Scripting

Perl script 'system' linking to local shell script not working

Trying to figure out why this works: printpwd.pl #!/usr/bin/perl use CGI::Carp qw( fatalsToBrowser ); print "Content-type: text/html\n\n"; $A = system("pwd"); $A = `pwd`; print "$A\n"; ^^actually that works/breaks if that makes any sense.. i get the working directory twice but when... (5 Replies)
Discussion started by: phpfreak
5 Replies

7. Shell Programming and Scripting

Script not working..."sort" not working properly....

Hello all, I have a file - 12.txt cat 12.txt =============================================== Number of executions = 2 Total execution time (sec.ms) = 0.009883 Number of executions = 8 Total execution time (sec.ms) = 0.001270 Number of... (23 Replies)
Discussion started by: Rahulpict
23 Replies

8. SCO

Sco-Unix IP Printer no longer working

I have a client running Sco-Unix 5. They have many IP Printers setup. One of the IP Printers is "LPJ", it has been functional for 3 weeks and then the switch died and hung up the queue. We reset the switch and restarted the jobs and they printed. The switch went down again and we replaced the... (1 Reply)
Discussion started by: Netwrkengeer
1 Replies
Login or Register to Ask a Question