Announcement

Collapse
No announcement yet.

How to make a file in linux like windows .bat file

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to make a file in linux like windows .bat file

    hello

    i would like to know how can i make a ".bat" file in linux for continuous ping an ip address


    thnx in advance..

    #2
    Re: How to make a file in linux like windows .bat file

    Hi,

    Well in linux/unix it's called a shell script and it's pretty much the same way as in windows. You open an editor (I like vi) but you can use any. Then type in the command you want to run, then save the file. You have to change the file permissions so that it is executable and then just run it. This is really over simplistic but gives you the general idea. Lot's of good info on scripting almost everywhere on the web.



    Comment


      #3
      Re: How to make a file in linux like windows .bat file

      i opend kate and i wrote ping "and the ip" then i saved it on desktop..
      its permissions are -rwxr-xr-r i think i made it executable.
      how can i "run" it? ;p

      Comment


        #4
        Re: How to make a file in linux like windows .bat file

        You can open a terminal (konsole, xterm, etc.) and run it from the command line.

        -- contents of script --
        #!/bin/sh

        ping 127.0.0.1
        -- end of file --

        make it executable with 'chmod +x script'
        run it with './script'

        the ./ in front of the name is required because normally only programs/scripts which are in your $PATH will be executed. this way you tell it to execute a local file.

        a good manual on how to do more advanced things would be the 'advanced bash scripting guide' (http://tldp.org/LDP/abs/html/).

        good luck!

        Comment


          #5
          Re: How to make a file in linux like windows .bat file

          thnx a lot!! i did it )

          Comment

          Working...
          X