1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

MS Dos Batch file converted to Shell.

Discussion in 'Software Development' started by Boylett, Feb 9, 2007.

Thread Status:
Not open for further replies.
  1. Boylett

    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
     
  2. AGCurry

    AGCurry

    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...
     
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 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/542739

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice