The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Operating Systems > OS X (Apple)
.
google unix.com



OS X (Apple) OS X is a line of Unix-based graphical operating systems developed, marketed, and sold by Apple.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Terminal script black-eyed-dog OS X (Apple) 10 01-23-2009 08:13 AM
start a new terminal from a script after opening VPN borderblaster IP Networking 0 01-18-2009 03:46 PM
running terminal with script cdfd123 Shell Programming and Scripting 3 12-13-2008 03:35 AM
run script through terminal sadiquep Linux 5 09-24-2008 08:44 AM
Script to launch terminal window? omerta SUN Solaris 5 06-30-2005 06:48 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-20-2009
drdread drdread is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 6
terminal script stops after script command :(.

Hello,

i am trying to write a script for terminal for my mac that i may drag into the terminal and will excute the following command:

script -akq Desktop/TerminalLogin/Cisco1Bob.txt
telnet x.x.x.x

the problem is that when i drag the text file to the terminal window the script stops after the
script -akq Desktop/TerminalLogin/Cisco1Bob.txt
line and does not send the telnet to the screen,

any idea how to over come this problem?

Thanks,

Rasta
  #2 (permalink)  
Old 01-20-2009
tlarkin tlarkin is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 43
I am not familiar with the script command....

You typically start a shell script with a shebang, either #!/bin/bash or #!/bin/sh.

Next when you save the script, save it with the .command extension, which will make it executable from the GUI so you can just double click your script and not have to run it from terminal.

Are you trying to read something from that text file?
  #3 (permalink)  
Old 01-21-2009
drdread drdread is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 6
not sure there.

Hey there,

the script command logs all screen output (from the terminal) to a file, so i may review later on.

is there a different command that may do this?

this is what i got for the script (.common file):

telnet 6.20.9.35
Admin
xxxx

this is what i get when i run it in the terminal:

rastas-macbook:~ Rasta$ /Users/Rasta/Desktop/login1.common ; exit;
Trying 6.20.9.35...
Connected to cust-6.20.9.35.switchn.com.
Escape character is '^]'.


User Access Verification

Username:
Username:
Username:
Connection closed by foreign host.
/Users/Rasta/Desktop/login1.common: line 2: Admin: command not found
/Users/Rasta/Desktop/login1.common: line 3: Admin1LV082008: command not found
logout

[Process completed]




any ideas?

J.
  #4 (permalink)  
Old 01-21-2009
tlarkin tlarkin is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 43
It looks like its not authenticating. but it is hard to tell with out seeing the whole script. Can you copy/paste the whole script? You can leave out any personal information about the systems, I just want to see what commands with what switches are running.

Thanks
  #5 (permalink)  
Old 01-21-2009
drdread drdread is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 6
here we go.

hey boss,

this is the hole script:

telnet 6.20.9.35
Admin
xxxx

its all in a text file that i converted to .common and made executable.
  #6 (permalink)  
Old 01-21-2009
pludi's Avatar
pludi pludi is online now Forum Staff  
Moderator
  
 

Join Date: Dec 2008
Location: .at
Posts: 1,972
AFAIK MacOS X uses tcsh as it's default shell (or do you use something else?). If so, I have two suggestions:
  1. Use another shell. csh/tcsh are bad in terms of usability for more than executing simple commands
  2. Try changing your script as follows
    Code:
    telnet 6.20.9.35 <<EOF
    Admin
    Password
    EOF

I can't guarantee that that will work, as most implementations of telnet will only accept input from the terminal (keyboard that is). If the code above does not work, you should look into enabling access via SSH and a keypair. If that's not possible, try expect or netcat.
  #7 (permalink)  
Old 02-04-2009
tlarkin tlarkin is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 43
OS X 10.5 uses bash as the default shell for every user, and sh for the root user.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:45 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0