LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-02-2004, 02:41 AM   #1
pen^2
Member
 
Registered: Mar 2003
Distribution: SuSE 9.0
Posts: 51

Rep: Reputation: 15
Whats wrong with my dialing script?


I have a fresh install of Fedora Core 2 (default desktop) and I have been unable to use my dial up connection with it. I have made posts about it in the past, [url]here is the main one.

I've given up trying to get wvdial to work, but I found this dialing script in another post here:

Code:
~# cat ppp-test.sh
#!/bin/sh
#
# The info behind the equal signal must not contain spaces
#
REMOTEHOST=myisp.com.au # your ISP domain name
TELEPHONE=123456789    # your ISP phone number
ACCOUNT=myname   # your account name on your ISP
PASSWORD=mypassword # your password
DEVICE=/dev/ttyS1 # modem port
SPEED=115200 # modem speed
#
[ ! -d /etc/ppp ] && mkdir /etc/ppp
SECRET=`echo \"$ACCOUNT\"       \"$REMOTEHOST\" \"$PASSWORD\"`
if [ ! -e /etc/ppp/pap-secrets ] || [ `egrep -c "$SECRET" /etc/ppp/pap-secrets` -eq 0 ]
then
  echo "$SECRET" >>/etc/ppp/pap-secrets
fi
if [ ! -e /etc/ppp/chap-secrets ] || [ `egrep -c "$SECRET" /etc/ppp/chap-secrets` -eq 0 ]
then
  echo "$SECRET" >>/etc/ppp/chap-secrets
fi
exec /usr/sbin/pppd \
        lock \
        modem \
        crtscts \
        $DEVICE \
        115200 \
        kdebug 0 \
        noauth \
        noipdefault \
        defaultroute \
        ipcp-accept-local \
        ipcp-accept-remote \
        usepeerdns \
        name $ACCOUNT \
        remotename $REMOTEHOST \
        connect "       \
        /usr/sbin/chat -v       \
                TIMEOUT         3       \
                ABORT   '\nBUSY\r'      \
                ABORT   '\nNO ANSWER\r' \
                ABORT   '\nRINGING\r\n\r\nRINGING\r'    \
                ''      '\rAT'  \
                'OK-+++\c-OK'   'AT&F1M1L0X4'   \
                TIMEOUT         45      \
                OK      ATX4    \
                OK      ATD${TIPDISC}${TELEPHONE}       \
                CONNECT         '
I saved it as “dialup” made it executable, and ran it as root but get the following errors:

./dialup: line 1: ~#: command not found
./dialup: line 50: syntax error: unexpected end of file

Strange since it's only 49 lines long, but it keeps adding a blank line anyway. Can somebody tell me how I can resolve these errors and perhaps finally get online with Fedora?

Thanks in advance.
 
Old 09-02-2004, 03:25 AM   #2
murugesan
Member
 
Registered: May 2003
Location: Bangalore ,Karnataka, India, Asia, Earth, Solar system, milky way galaxy, black hole
Distribution: murugesan openssl
Posts: 181

Rep: Reputation: 29
Remove the '~' symbol at the beginning of the script.
 
Old 09-02-2004, 03:47 AM   #3
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Rep: Reputation: Disabled
Re: Whats wrong with my dialing script?

Quote:
Originally posted by pen^2
...
~# cat ppp-test.sh
...
Looks like you left this
Code:
~# cat ppp-test.sh
in your file which will obviously produce an error
(Also, first line must be the shell declaration, i.e. your #!/bin/sh).


Quote:
Originally posted by pen^2
....
/dialup: line 50: syntax error: unexpected end of file
...
What about an exit statement like
Code:
exit 0
?


Last edited by JZL240I-U; 09-02-2004 at 03:50 AM.
 
Old 09-03-2004, 02:48 AM   #4
pen^2
Member
 
Registered: Mar 2003
Distribution: SuSE 9.0
Posts: 51

Original Poster
Rep: Reputation: 15
Thanks for the help so far, but its only half solved. The first error is gone, but even with the exit statement I get the "./dialup: line 50: syntax error: unexpected end of file" error, any more ideas?

Thanks again.
 
Old 09-03-2004, 02:52 AM   #5
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Rep: Reputation: Disabled
Please indicate line 50.

Did you delete one line? If so, why is the error still at line 50 and not at 49?
 
Old 09-03-2004, 03:46 AM   #6
pen^2
Member
 
Registered: Mar 2003
Distribution: SuSE 9.0
Posts: 51

Original Poster
Rep: Reputation: 15
I didn't delete any lines, all I did was add the line "exit 0" to the end. The reason it says line 50 is because I copied the error from my post rather than the terminal, just got lazy. It's the last line anyway.

Thanks.
 
Old 09-03-2004, 04:18 AM   #7
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Rep: Reputation: Disabled
Um, your last line holds only one '
i.e.
Code:
CONNECT         '
I don't know the syntax, but that seems unusual?!?
What about deleting it or using two of them...
 
Old 09-03-2004, 05:29 AM   #8
pen^2
Member
 
Registered: Mar 2003
Distribution: SuSE 9.0
Posts: 51

Original Poster
Rep: Reputation: 15
I apologise for the confusion so far. This is what the script currently looks like.

Code:
#!/bin/sh
# cat ppp-test.sh
#
# The info behind the equal signal must not contain spaces
#
REMOTEHOST=domain.com.au # your ISP domain name
TELEPHONE=0123456789    # your ISP phone number
ACCOUNT=myname   # your account name on your ISP
PASSWORD=mypassword # your password
DEVICE=/dev/ttyS1 # modem port
SPEED=115200 # modem speed
#
[ ! -d /etc/ppp ] && mkdir /etc/ppp
SECRET=`echo \"$ACCOUNT\"       \"$REMOTEHOST\" \"$PASSWORD\"`
if [ ! -e /etc/ppp/pap-secrets ] || [ `egrep -c "$SECRET" /etc/ppp/pap-secrets` -eq 0 ]
then
  echo "$SECRET" >>/etc/ppp/pap-secrets
fi
if [ ! -e /etc/ppp/chap-secrets ] || [ `egrep -c "$SECRET" /etc/ppp/chap-secrets` -eq 0 ]
then
  echo "$SECRET" >>/etc/ppp/chap-secrets
fi
exec /usr/sbin/pppd \
        lock \
        modem \
        crtscts \
        $DEVICE \
        115200 \
        kdebug 0 \
        noauth \
        noipdefault \
        defaultroute \
        ipcp-accept-local \
        ipcp-accept-remote \
        usepeerdns \
        name $ACCOUNT \
        remotename $REMOTEHOST \
        connect "       \
        /usr/sbin/chat -v       \
                TIMEOUT         3       \
                ABORT   '\nBUSY\r'      \
                ABORT   '\nNO ANSWER\r' \
                ABORT   '\nRINGING\r\n\r\nRINGING\r'    \
                ''      '\rAT'  \
                'OK-+++\c-OK'   'AT&F1M1L0X4'   \
                TIMEOUT         45      \
                OK      ATX4    \
                OK      ATD${TIPDISC}${TELEPHONE}       \
                CONNECT         ''"
exit 0
Then when I run it I get the error:

line 51: syntax error: unexpected end of file.

As before the script is only 50 lines long, but as soon as I run it an extra blank line is added to the end.

Thanks again for the help thus far.
 
Old 09-03-2004, 06:08 AM   #9
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Rep: Reputation: Disabled
What editor did you use? Reason for my question is Microsoft, of course .

*nix needs only one of <CR/LF> (Carriage Return / Line Feed of the typewriters of olden), µsoft both. Find out what your editor inserts when you hit <Enter> and change it if necessary or use another editor -- maybe this is causing your problem...
 
Old 09-03-2004, 07:17 AM   #10
pen^2
Member
 
Registered: Mar 2003
Distribution: SuSE 9.0
Posts: 51

Original Poster
Rep: Reputation: 15
The only editors I have used are gedit and vi. Neither is set to insert more than one carriage return so I don't think thats the problem.

I really appreciate all the help, although its beginning to look hopeless.
 
Old 09-03-2004, 08:14 AM   #11
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Rep: Reputation: Disabled
I don't know your system. So.

Code:
#!/bin/sh
means "This is a script -- for any shell you might want to use". Just to be sure try
Code:
#!/bin/bash
This is not portable but might clear the problem. (Google asked for "linux bash syntax error: unexpected end of file" comes up with mostly syntax errors concerning the if statement. You might want to experiment here further...).

Umm, that's assuming you use bash...

Last edited by JZL240I-U; 09-03-2004 at 08:15 AM.
 
Old 09-16-2004, 02:07 AM   #12
hari_s_82
LQ Newbie
 
Registered: Sep 2004
Posts: 20

Rep: Reputation: 0
RE:whats wrong with my script

Hi,
It seems like you have missed the semi colon(;) after the if statement. Just try adding the semi-colon and see whether it works. Usually i have encountered these kind of errors when i have screwed up something with the if statement. Just try this one ok.

Three common errors can occur when using the if statement:

• Omitting the semicolon (;) before the then statement in the single line form.
• Using else if or elsif instead of elif.
• Omitting the then statement when an elif statement is used.
• Writing if instead of fi at the end of an if statement.

Last edited by hari_s_82; 09-16-2004 at 02:10 AM.
 
Old 09-16-2004, 02:22 AM   #13
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Rep: Reputation: Disabled
That's a very good list. Thanks for posting it .
 
Old 09-16-2004, 02:34 AM   #14
hari_s_82
LQ Newbie
 
Registered: Sep 2004
Posts: 20

Rep: Reputation: 0
Thanks, hope it works
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
whats wrong with my fsck? Dillius Mandriva 5 02-19-2005 04:18 PM
whats wrong with krnel 2.6.8.1 masand Linux - Software 19 08-24-2004 01:13 PM
Whats wrong with this script??? Sammy2ooo Linux - Networking 2 08-24-2004 06:20 AM
Whats wrong with this PERL script? VisionZ Linux - Newbie 25 03-25-2004 08:58 AM
Whats wrong with this? OlRoy Programming 2 05-28-2003 01:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration