MS Dos Batch file converted to Shell.

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Boylett

Thread Starter
Joined
Dec 23, 2006
Messages
55
I can write a bit in ms dos batch but i need it to work in linux so can someone help me convert it to shell?

This is my current (MS Dos Batch):
Code:
@ECHO off

goto main

:main
cd /server/scriptfiles
IF EXIST file.txt goto echo
goto main

:echo
COPY /A file.txt file2.txt /Y
Del file.txt
goto main
Can someone convert it to shell? Thanks
 
Joined
Jun 15, 2005
Messages
431
@ECHO off

goto main

:main
cd /server/scriptfiles
IF EXIST file.txt goto echo
goto main

:echo
COPY /A file.txt file2.txt /Y
Del file.txt
goto main

#!/bin/ksh

while true
do
if [ -f /server/scriptfiles/file.txt ]
then
mv /server/scriptfiles/file.txt /server/scriptfiles/file2.txt
fi
sleep 10
done
exit 0

I put in the sleep statement because you don't want to be forever looping millions of times per second...
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top