+ Post New Thread
Results 1 to 5 of 5
*nix Thread, Linux "batch" equivalent? in Technical; I'm a Linux-noob and am almost embarrassed to ask this. I've been playing around with various Live CDs and always ...
  1. #1

    Join Date
    May 2009
    Location
    UK
    Posts
    294
    Thank Post
    64
    Thanked 21 Times in 20 Posts
    Rep Power
    15

    Linux "batch" equivalent?

    I'm a Linux-noob and am almost embarrassed to ask this. I've been playing around with various Live CDs and always start my session with a series of commands to set the IP address, DNS, DG and a few other things. I know that I can use DHCP but I like to use static addresses. I know that I can create a batch file in Windows to replicate a series of commands at the command prompt, but is there anything similar in Linux? If so, I'd plan to create the file and save it either to a flash drive or on the hard drive of the laptop upon which I'm running the Live CD so it would be easy to pick up at the beginning of the session, run it, and my configuration would be set.

    If this isn't possible, I guess I could copy/paste the commands from a text file to set the configuration that I want.

    As I say, I'm to ask such a low level question.

  2. #2
    kesomir's Avatar
    Join Date
    Mar 2008
    Location
    London
    Posts
    288
    Thank Post
    15
    Thanked 28 Times in 23 Posts
    Rep Power
    18

  3. 2 Thanks to kesomir:

    Ignatius (13th October 2009), llawwehttam (18th October 2009)

  4. #3


    Join Date
    Feb 2007
    Location
    Northamptonshire
    Posts
    4,692
    Thank Post
    352
    Thanked 797 Times in 716 Posts
    Rep Power
    347
    Shell scripting depending upon which shell you have but a popular one is Bash as Kesomir has provided some good links to.

    An example:


    Code:
    #!/bin/bash
    ifconfig eth0 inet 192.168.1.34 netmask 255.255.255.0
    route add default gw 192.168.1.1
    echo "nameserver 192.168.1.3" > /etc/resolv.conf
    echo "nameserver 192.168.1.4" >> /etc/resolv.conf
    export http_proxy="http://proxy.mysite.com:80"
    export ftp_proxy="http://proxy.mysite.com:80"

  5. Thanks to kmount from:

    Ignatius (13th October 2009)

  6. #4

    Join Date
    May 2009
    Location
    UK
    Posts
    294
    Thank Post
    64
    Thanked 21 Times in 20 Posts
    Rep Power
    15
    Perfect, that's just what I want ... some "buzz words" to research!

  7. #5
    llawwehttam's Avatar
    Join Date
    Nov 2008
    Location
    Birmingham
    Posts
    223
    Thank Post
    56
    Thanked 3 Times in 3 Posts
    Blog Entries
    2
    Rep Power
    14
    Personally I use sh for this purpose in vim.
    Theres nothing easier than
    vim program.sh
    .....
    sh program.sh

    or you can
    chmod -x program.sh
    ./program.sh
    Last edited by llawwehttam; 18th October 2009 at 01:23 PM.

SHARE:
+ Post New Thread

Similar Threads

  1. Set the AD "Home Path" with a batch file?
    By eejit in forum How do you do....it?
    Replies: 8
    Last Post: 14th September 2009, 10:09 AM
  2. Replies: 3
    Last Post: 11th September 2009, 09:01 AM
  3. [Debian] Debian GNU/Linux 5.0 "Lenny" released
    By powdarrmonkey in forum *nix
    Replies: 3
    Last Post: 15th February 2009, 02:46 PM
  4. Replies: 31
    Last Post: 30th June 2008, 10:03 AM
  5. Replies: 6
    Last Post: 28th September 2006, 07:06 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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