Solved

fix this shell script

Posted on 2006-11-17
1
188 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

This is the error message I got (CODE) Error caused by incompatible libmp3lame 3.98-2 with ffmpeg I've googled this error message and found out sometimes it attaches this note "can be treated with downgrade libmp3lame to version 3.97 or 3.98" …
Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
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 navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

831 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