LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-14-2015, 12:47 AM   #1
AID50NY
LQ Newbie
 
Registered: Feb 2015
Posts: 2

Rep: Reputation: Disabled
Kermit Scripting syntax


Hello folks
I have a little Raspberry Pi box running Debian that I use
as a Terminal server for connecting to my Routers and switches.
7 devices in total so I am trying to create a script
from the stand-alone commands I type to connect.
kermit -l /dev/ttyUSB0
set carrier-watch off
connect.
Individually these lines work.

In a script
#!/bin/sh
kermit -l /dev/ttyUSB0
set carrier-watch off
connect

or

#!/bin/sh
kermit -l /dev/ttyUSB0 "set carrier-watch off, connect"
or
anything else does not work.

What am I missing?

Thanks
 
Old 02-15-2015, 09:35 PM   #2
codeguy
Member
 
Registered: Jan 2004
Distribution: Slackware
Posts: 129

Rep: Reputation: 16
I've never used kermit, so this is a guess. I'll bet kermit is starting a console that you then enter the commands "set ..." and "connect" into.

But when you run it as a bash script, the kermit command starts and bash will wait for it to finish before running the next line of the script. (Bash doesn't know to send the two lines to kermit. Its going to try to run them as if they were bash commands).

Try something like:

#!/bin/sh
echo <<EOF | kermit -l /dev/ttyUSB0
set carrier-watch off
connect
EOF


That'll run kermit, and then pipe everything until EOF to it. <<EOF is called a heredoc and the pipe is called a pipe. (Its the thing by the backslash).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash shell scripting basic question regarding the syntax BeingGokul Linux - General 2 09-23-2013 11:39 AM
syntax error near unexpected token 'done' (Bash scripting, first time, loops) Longeron Linux - Newbie 3 01-19-2013 07:52 AM
C-shell scripting syntax error chrisjorg Programming 1 04-06-2011 04:47 AM
Syntax Question for scripting - if conditions jim.thornton Linux - Newbie 2 04-08-2008 10:51 PM
expect scripting syntax problems...(catch, echo,....) wedgeworth Linux - Software 2 10-02-2003 10:24 AM


All times are GMT -5. The time now is 06:44 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration