Solved

fix this shell script

Posted on 2006-11-17
1
185 Views
Last Modified: 2010-04-20
I have the below shell script

FILE=$1;
i=5

for ip in 'cat $FILE'
do
 i='expr $i + 1'
 /sbin/ifconfig eth0:$i $ip netmask 255.255.255.0
 /sbin/route add $ip eth0:$i
done

This should go through a fileand bind each line (IP) to the eth0. However its not working. I believe the script is fine but how should I call it from the terminal?
0
Comment
Question by:JPERKS1985
1 Comment
 
LVL 84

Accepted Solution

by:
ozo earned 500 total points
ID: 17968914
I think you probably meant
for ip in `cat $FILE`
do
 i=`expr $i + 1`

` instead of '
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now