Solved

fix this shell script

Posted on 2006-11-17
1
190 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to demonstrate how we can use conditional statements using Python.
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will giveā€¦
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses

632 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