LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   syntax error: unexpected end of file (https://www.linuxquestions.org/questions/linux-newbie-8/syntax-error-unexpected-end-of-file-4175536291/)

Revenge7 03-10-2015 09:42 AM

syntax error: unexpected end of file
 
Hi!
I wrote a script shell about changing IP of the httpd.conf from text file and saving a new httpd.conf file for all IPs in the text file. The code is below, Im using mremote on windows (RHEL Release 5.7), and getting this error:
./script1.sh: line 19: syntax error: unexpected end of file

Please help me about that error. Thanks!

(ps: line 19 is the last line in the code => done < "$filename" )

#!/bin/bash

DATE='date +%Y%m%d_%H:%M:%S'
NAME=httpd_ip_change
EXTENSION=conf
max=10

filename="$1"
while read -r line

for ((i=2; i<=$max; ++i ))

do
touch $NAME$i.$EXTENSION.$DATE

sed "s/<VirtualHost 10.11.92.81:80>/$line/g" ./httpd.conf > $NAME$i.$EXTENSION.$DATE

done < "$filename"

suicidaleggroll 03-10-2015 09:57 AM

You're missing the "do" on your while loop and the "done" on your for loop.

Revenge7 03-19-2015 04:35 AM

Quote:

Originally Posted by suicidaleggroll (Post 5329884)
You're missing the "do" on your while loop and the "done" on your for loop.

Thanks ! It helped.


All times are GMT -5. The time now is 02:25 AM.