Jump to content

Recommended Posts

Posted

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 :o to ask such a low level question.

Posted

Shell scripting depending upon which shell you have but a popular one is Bash as Kesomir has provided some good links to.

 

An example:

 

 

#!/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"

  • Thanks 1
Posted (edited)

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

Edited by llawwehttam

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...