Thread: How do you execute a shell script file??

  1. #1
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    2,158

    How do you execute a shell script file??

    I know this may not be a very intelligent question, but, how do you execute a shell script file in windows? I tried changing it's extention from .sh to .bat, but it seems that the scripts aren't the same. I'm somewhat confused about this, as I have read it has somthing to do with unix??

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Yes, shell script is "batch files in Unix". Both formats support executing applications, doing simple flow-control and variable stuff, such as for-loops, gotos, if statements, and such like.

    To run a shell-script in Windows, you need to have a shell implemented in Windows. There are some of those available. You will also need to have all applications that the script makes use of [naturally].

    Here's a link that google put as "best match" when I searched for "csh for windows".
    http://www.shelldorado.com/links/

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by Yarin View Post
    I know this may not be a very intelligent question, but, how do you execute a shell script file in windows? I tried changing it's extention from .sh to .bat, but it seems that the scripts aren't the same. I'm somewhat confused about this, as I have read it has somthing to do with unix??
    A shell script is interpreted by a shell. You don't have a shell, so you can't run a shell script.

    Shell scripts often rely on UNIX commands that don't exist on Windows, too.

    If you download and install Cygwin, you might be able to make it work.

  4. #4
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by matsp View Post
    Yes, shell script is "batch files in Unix". Both formats support executing applications, doing simple flow-control and variable stuff, such as for-loops, gotos, if statements, and such like.
    Must disagree on the "simple" part. You can write very complex functionality in shell script. For an undergraduate class, I wrote a cross-platform virus in pure sh script.

  5. #5
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    2,158
    Okay, thanks. I downloaded Cygwin, but I'm on a library computer right now;
    I just finished downloading Fedora 8 (Gmone & KDE). Yay!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. To find the memory leaks without using any tools
    By asadullah in forum C Programming
    Replies: 2
    Last Post: 05-12-2008, 07:54 AM
  2. Need Help Fixing My C Program. Deals with File I/O
    By Matus in forum C Programming
    Replies: 7
    Last Post: 04-29-2008, 07:51 PM
  3. Basic text file encoder
    By Abda92 in forum C Programming
    Replies: 15
    Last Post: 05-22-2007, 01:19 PM
  4. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02:53 AM
  5. Simple File encryption
    By caroundw5h in forum C Programming
    Replies: 2
    Last Post: 10-13-2004, 10:51 PM