Results 1 to 16 of 16
  1. #1
    Join Date
    Feb 2002
    Posts
    956

    Like MS-DOS batch file but for Linux?

    how
    thanks

  2. #2
    Join Date
    Jun 2001
    Location
    Earth
    Posts
    1,259
    Umm, it's just like writing a dos batch file, but you don't need the extension. Assuming you're using bash as a shell, make the first line of the scirpt:

    #! /bin/bash

    And then just type the commands you want to execute. Change the script to be executable and presto! shell script.

    That first line tells the shell to run this script under bash.

    If you can give more details, I can give a more specific example.

    Frank
    Umbra Hosting
    cPanel | Softaculous | CloudLinux | R1Soft | Ksplice
    Web Hosting, Reseller Hosting, VPS, Dedicated Servers, Colocation
    UmbraHosting.com

  3. #3
    Join Date
    Feb 2002
    Posts
    956
    thanks!

  4. #4
    Join Date
    Nov 2001
    Location
    Canada
    Posts
    1,963
    its called shell scripting! hehe

  5. #5
    Join Date
    Feb 2002
    Posts
    956
    I have one question, if I put echo "test" in one of those files and run it, what would it output?

    echo "test"
    test
    or just
    test
    This forum officially ****ing sucks

  6. #6
    Join Date
    Nov 2001
    Location
    Canada
    Posts
    1,963
    the second

    e..g

    if i type

    pico file.sh
    #!/bin/bash
    echo yo whats your name
    read name
    echo hey whats up $name

    then save that file
    chmod +x file.sh
    then type ./file.sh

    you will see

  7. #7
    Join Date
    Feb 2002
    Posts
    956
    now how do i make a command run in it, but not output anything?
    This forum officially ****ing sucks

  8. #8
    Join Date
    Nov 2001
    Location
    Canada
    Posts
    1,963
    ./file.sh>/dev/null& will make it not output anything and put it in the backround

    ./file.sh>/dev/null will just run it and not show any output

    you prolly wanna use choice #2

  9. #9
    Don't tell him to make BASH shell scripts?!?!?

    #!/bin/ksh

    Sheesh.

  10. #10
    Join Date
    Apr 2002
    Location
    Troy, MI
    Posts
    324
    ksh! akk - you mean csh dont you - yes you do
    Ryan MacDonald
    Lead Administrator | TotalChoice Hosting
    Choice Does Matter! | Serving over 26,000 clients

  11. #11
    Join Date
    Nov 2001
    Location
    Canada
    Posts
    1,963
    who cares

  12. #12
    Join Date
    Jun 2001
    Location
    Earth
    Posts
    1,259
    Well you'll care a little bit .

    Most systems won't have /bin/ksh on them unless you've installed pdksh. And there are syntax differences between /bin/csh, /bin/sh and /bin/bash.

    Frank
    Umbra Hosting
    cPanel | Softaculous | CloudLinux | R1Soft | Ksplice
    Web Hosting, Reseller Hosting, VPS, Dedicated Servers, Colocation
    UmbraHosting.com

  13. #13
    Join Date
    May 2002
    Posts
    542
    Originally posted by ffeingol
    And there are syntax differences between /bin/csh, /bin/sh and /bin/bash.
    Precisely why I use a universal language, Perl, to do all of my scripting
    Jay » jay@frontdrive.com • AIM » FDrive Support
    Front Drive™ » Advanced multi-domain solutions
    http://www.frontdrive.com/

  14. #14
    Join Date
    Apr 2002
    Location
    Sacramento, CA
    Posts
    220
    Originally posted by FDrive


    Precisely why I use a universal language, Perl, to do all of my scripting
    I second that
    Joel Strellner

  15. #15
    Join Date
    Jun 2001
    Location
    Earth
    Posts
    1,259
    Originally posted by FDrive

    Precisely why I use a universal language, Perl, to do all of my scripting
    Well I generally agree with you, but perl can have "some" of the same issues. You need to make sure that the same version/modules etc. are installed on each box you want ot run the script on.

    Frank
    Umbra Hosting
    cPanel | Softaculous | CloudLinux | R1Soft | Ksplice
    Web Hosting, Reseller Hosting, VPS, Dedicated Servers, Colocation
    UmbraHosting.com

  16. #16
    I just always prefer shellscripting
    Leon Mergen
    leon@antrophia.com
    http://www.antrophia.com/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •