bash line 74: syntax error: unexpected end of file help?
hey guys
Please can someone help me can you see what the error is here in my script # PPPOE SETUP echo -e "Would you like to Setup the ADSL?: \c " read ADSL if [ "$ADSL?" = "yes" ]; then echo -e "Default Route?: \c " read Route? if [ "Route?" = "yes" ]; then cat > /etc/sysconfig/network-scripts/ifcfg-ppp0 << CFG USERCTL=yes PEERDNS=no TYPE=xDSL DEVICE=ppp0 BOOTPROTO=dialup ONBOOT=yes PIDFILE=/var/run/pppoe-adsl-0.pid FIREWALL=NONE PING=. PPPOE_TIMEOUT=80 LCP_FAILURE=3 LCP_INTERVAL=20 CLAMPMSS=1412 CONNECT_POLL=6 CONNECT_TIMEOUT=0 PERSIST=no SYNCHRONOUS=no DEFROUTE=yes PROVIDER=provider ETH=eth0 DEMAND=no USER='andrew@andrew.co.za' CFG cat > /etc/ppp/pap-secrets << CFG1 "andrew@andrew.co.za" "*" andrew "*" ####### redhat-config-network will overwrite this part!!! (begin) ########## ####### redhat-config-network will overwrite this part!!! (end) ############ CFG1 else if [ "Route?" = "no" ]; then cat > /etc/sysconfig/network-scripts/ifcfg-ppp0 << CFG2 USERCTL=yes PEERDNS=no TYPE=xDSL DEVICE=ppp0 BOOTPROTO=dialup ONBOOT=yes PIDFILE=/var/run/pppoe-adsl-0.pid FIREWALL=NONE PING=. PPPOE_TIMEOUT=80 LCP_FAILURE=3 LCP_INTERVAL=20 CLAMPMSS=1412 CONNECT_POLL=6 CONNECT_TIMEOUT=0 PERSIST=no SYNCHRONOUS=no DEFROUTE=no PROVIDER=provider ETH=eth0 DEMAND=no USER='andrew@andrew.co.za' CFG2 cat > /etc/ppp/pap-secrets << CFG3 "andrew@andrew.co.za" "*" andrew "*" ####### redhat-config-network will overwrite this part!!! (begin) ########## ####### redhat-config-network will overwrite this part!!! (end) ############ CFG3 fi when i run it it goes to the first part saying "would you like to setup the ADSL' then i say yes and it says ./adsl: line 74: syntax error: unexpected end of file any ideas why? ta andrew |
Hi,
You seem to be missing a lot of fi statements. I see three if [......] statements and only 1 fi statement (missing 2). You also use an if statement right after an else statement, which could be correct but I do believe you want an elif (else if) statement. Also: Start your script with #!/bin/bash Hope this helps. PS: Next time you post a piece of code, put it between code tags ( [ code ] ..... [ /code ] (without the spaces)]. |
hmm my bash is not very good
can you gimme an example? |
Hi,
An example of what? if - then - else - fi: Code:
#!/bin/bash This might help: Advanced Bash-Scripting Guide Specific (if/then/else/fi): Chapter 7. Tests |
Hi,
I'm not sure if this is what you want/need, but here's your script (shortened and somewhat re-written): Code:
#!/bin/bash |
aah that makes sense
Thanks alot :) |
All times are GMT -5. The time now is 08:04 PM. |