Page 1 of 3 123 LastLast
Results 1 to 10 of 25

Thread: help with writing script

  1. #1
    Senior Member registered user
    Join Date
    Feb 2004
    Posts
    237

    help with writing script

    I need to wite a very small simple script and save it to desktop to run when i need to. It is an TELNET session that runs in the Konsole. At the prompt: bob@Gateway:~$ I type in "telnet", without quotes, then "open" and then "n7us.net" So it looks like this:

    bob@Gateway:~$ telnet <enter>
    telnet> open n7us.net <enter>

    Then it connects to the ham radio site where I can sign in. I need to know how to make a script that would do this instead of me having to type it in each time. I need the commands to:

    1. bring up the Konsole
    2. have it put in the command "telnet"
    3. have it put in the command open n7us.net
    4. have it enter/carraige return

    then i can take control from there.......any ideas???? bob

  2. #2
    Senior Member registered user
    Join Date
    Feb 2004
    Posts
    949

    Re: help with writing script

    Quote Originally Posted by bob58
    I need to wite a very small simple script and save it to desktop to run when i need to. It is an TELNET session that runs in the Konsole. At the prompt: bob@Gateway:~$ I type in "telnet", without quotes, then "open" and then "n7us.net" So it looks like this:

    bob@Gateway:~$ telnet <enter>
    telnet> open n7us.net <enter>

    Then it connects to the ham radio site where I can sign in. I need to know how to make a script that would do this instead of me having to type it in each time. I need the commands to:

    1. bring up the Konsole
    2. have it put in the command "telnet"
    3. have it put in the command open n7us.net
    4. have it enter/carraige return

    then i can take control from there.......any ideas???? bob
    Try makeing a script called telconnect.sh (You can use a standard txt file)
    Open it and put in
    Code:
    telnet n7us.net
    Then open up a consol type
    su
    chmod a+x /directory/telconnect.sh

    then just type /directory/telconnect.sh (or ./telconnect.sh if your in the directory.)

    *edited, fixed it

  3. #3
    Senior Member
    Join Date
    Oct 2003
    Location
    GA
    Posts
    382
    Couldn't you just create an icon in your KDE panel? Make sure that it's set to run in terminal (or however KDE calls it). Then the command would just be "telnet n7us.net". I think that would work anyways.

    Or if you really want a script you would just need to create a file with:

    Code:
    #!/bin/sh
    konsole -e telnet n7us.net
    You could call it hamtelnet.sh or whatever. Make sure that you chmod +x on it and it should work.

  4. #4
    Senior Member
    Join Date
    Oct 2003
    Location
    GA
    Posts
    382
    Oops...sorry firebyrd...I got distracted with something and didn't see your post before I responded.

  5. #5
    Senior Member registered user
    Join Date
    Jun 2004
    Posts
    788
    Code:
    #!/bin/sh
    konsole -e telnet n7us.net
    No need for konsole arg. if you going to run it in konsole unless you want to open new konsole.

    THe above command is suitable if you want to create link on your desktop but you need to remove the sh extension first. Make sure you change it to executable.


  6. #6
    Senior Member registered user
    Join Date
    Feb 2004
    Posts
    237

    telnet script

    Hello gentlemen...thank you for your help! I noticed in my KDE menu is another program called Telnet-ssl. I can save a stewp by using that, because when it is started, unlike the regular Konsole, the prompt is already at the TELNET point. Would i be able to substitute the word telnet in the below example with telnet-ssl?


    #!/bin/sh
    konsole -e telnet n7us.net


    I want to try learning scripts but I still am not too sure about how to go about it. OK I will try this example when I get home and post my results....thank you...bob

  7. #7
    Senior Member registered user
    Join Date
    Feb 2004
    Posts
    237

    correction!

    Wow its too early in the morning! My last post had an error: What I would like to know, is in the below example:

    Code:
    #!/bin/sh
    konsole -e telnet n7us.net


    Can i take out the word Konsole and put in telnet-ssl? Telnet-ssl is another Konsole-type mode that, when started, is already at the telnet prompt....I am wondering if this will save me a step or two. I am very familiar with doing DOS batch files, but Linux scripts are very confusing! I would like to learn because knowing scripts would be a benefit. thanks...bob

  8. #8
    Senior Member registered user
    Join Date
    Jun 2004
    Posts
    788
    Code:
    #!/bin/sh 
    konsole -e telnet-ssl n7us.net
    Don't think you can remove konsole because telnet run from konsole

  9. #9
    Senior Member registered user
    Join Date
    Jun 2004
    Posts
    788
    If you want a gui version of telnet-ssh , try Putty. Just apt-get.

  10. #10
    Senior Member registered user
    Join Date
    Feb 2004
    Posts
    237

    works great

    Hello again....Yah I see what you mean about the Konsole and Telnet-ssl being one in the same! I did make the script and it runs great!

    Thank you for the tip.....I do have another question....and I might be biting off alot more than I can chew with this one......considering my knowledge of shell scripts at the moment!

    I would like to be able to create a MENU with a few simple Knoppix programs that will run in the terminal. I like making batch files in DOS and I would like to see if I can do the same thing using Linux. I have an older computer that would be perfect for this...to run in command line only.

    If you are familiar with how to go about making a menu in dos using errorlevels and ANSI graphics.....I can do that very easily, but does anyone know how to code in linux to do something similar that will gun in a GUI - less environment? I can see now how to make a simple shell script and make it executable....but I have no clue where to start to creat a menu screen, using a box around it maybe with 4 or 5 menu choices in it....then when you pick. say the first choice on menu which is labeled "A" for example....the script finds the label and runs the program...then when you exit program, you are taken back to menu!

    I know this may sound crazy but this is goodtherapy for me to keep the ol brain working! bob58

Page 1 of 3 123 LastLast

Similar Threads

  1. writing to cd
    By sunnmoon in forum General Support
    Replies: 1
    Last Post: 06-15-2005, 04:08 PM
  2. V3.8.1 hd writing bug?
    By fmfischer in forum General Support
    Replies: 1
    Last Post: 04-14-2005, 11:07 AM
  3. Writing it to CD
    By irvine in forum The Lounge
    Replies: 4
    Last Post: 12-02-2004, 03:27 AM
  4. Writing to / and subdirs.
    By bikerman in forum General Support
    Replies: 1
    Last Post: 04-15-2004, 12:22 AM
  5. writing problem with usb pen
    By shadinio in forum Hardware & Booting
    Replies: 1
    Last Post: 03-25-2004, 09:09 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Knoppix NSM 1.2 picture

Knoppix NSM 1.2

$8.00



Knoppix Live GNU Linux System 9.1 on Bootable CD / DVD / USB Flash Drive picture

Knoppix Live GNU Linux System 9.1 on Bootable CD / DVD / USB Flash Drive

$9.99



KNOPPIX 9.1 LINUX INSTALL & LIVE DVD picture

KNOPPIX 9.1 LINUX INSTALL & LIVE DVD

$9.99



Linux Knoppix 4.0.2 Installation Disc picture

Linux Knoppix 4.0.2 Installation Disc

$29.99



Knoppix Linux Bootable OS v8.6

Knoppix Linux Bootable OS v8.6 "Original Live Operating System" 32G USB Stick

$20.30



Hamshack Live DVD-ROM picture

Hamshack Live DVD-ROM

$8.00



Acer Aspire One 9 inch Netbook ZG5 512MB RAM 8GB SSD HD Knoppix Linux WiFi VGA picture

Acer Aspire One 9 inch Netbook ZG5 512MB RAM 8GB SSD HD Knoppix Linux WiFi VGA

$79.99



Knoppix 3.4 Linux installation CD picture

Knoppix 3.4 Linux installation CD

$10.00



Knoppix Linux Bootable OS v8.6

Knoppix Linux Bootable OS v8.6 "Original Live Operating System" 16G USB Stick

$19.95