LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 09-12-2005, 09:54 AM   #1
neocookie
Member
 
Registered: Apr 2004
Location: Leeds, UK
Distribution: FC1, FC2, Debian
Posts: 308

Rep: Reputation: 30
Quick Challange for shell scripters!


Hi all

I've a quick challenge for all the shell scripters out there. I'm no good with shell scripting, and I'm sure you guys should be able to produce a quick and elegant solution to my problem...

My boss uses ssh sometimes to access a few servers from his mac. Not a very experienced terminal user, he gets a little lost with ssh on the terminal because of all the options.

Most of the time, he's accessing one of our servers, and just needs to pass the username, ip, and password to ssh.

We could do with a little script so that whenever we type #myssh we get two prompts:
Code:
#myssh
ip:
user:
Control can then pass to ssh for entering the password and all other commands.

How elegant can you make it?
 
Old 09-12-2005, 10:02 AM   #2
schneidz
Senior Member
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-19-live-usb/ aix
Posts: 3,823

Rep: Reputation: 586Reputation: 586Reputation: 586Reputation: 586Reputation: 586Reputation: 586
this should do it:

Code:
#!/bin/sh

echo ip:
read ip
#echo ip = $ip

echo user:
read user
#echo user = $user

ssh -l $user $ip
 
Old 09-12-2005, 10:13 AM   #3
neocookie
Member
 
Registered: Apr 2004
Location: Leeds, UK
Distribution: FC1, FC2, Debian
Posts: 308

Original Poster
Rep: Reputation: 30
great! gotta love *nix.
 
  


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
A Challange to all webwolf70 General 0 09-29-2005 07:36 PM
Quick way to send mail from shell? tobycatlin Linux - General 2 04-27-2005 06:27 AM
Quick Shell Question youssefe2k Linux - Software 2 04-10-2005 09:47 PM
Brain challange : Shell Variable xanthium Programming 5 02-07-2004 11:00 AM
I need a quick shell script. 360 Programming 3 03-22-2002 04:44 PM


All times are GMT -5. The time now is 09:11 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration