how about args?
./test.sh foo bar
foo would be treated as the variable $1, and bar $2, and so on...
Need some quick tips for a little script. I'm total dummy in shell scriptyng so don;t be afraid to treat me as such.
I need to run a simple script that :
1. Will run in terminal
2. Will execute 'telnet <hostname> 259'
3. User will be promted for credentials and after he has done so the terminal window should be closed.
4. Thuis script should be launced by clicking on the icon placed on the user desktop in X
A little help please.
Thanks.
how about args?
./test.sh foo bar
foo would be treated as the variable $1, and bar $2, and so on...
If that's not too much of imposition guys, can you drop a few lines for that script - I want to do some presenrtation for my boss as how linux can be used remotely from home for corporate users and the absense of this script is the only thing that stops me...
If it's not too much to ask.....I would;n wanna to postpone it indefinetely untill I figure put myself what to do with scripting....
I'm all for helping but you really need to give it a try for yourself first, then ask us for help, not do it for you.Code:#!/bin/bash telnet <hostname> 259
Do you need the script to be in Bash ? If not, all linux systems come with perl (most atleast)
so you can have this:
Code:#!/usr/bin/perl -w use strict; my $hostname; chop($hostname=<STDIN>); print `telnet $hostname 259`;
why print?
why not exec() or system()?
[quote author=gorn link=board=9;threadid=9600;start=0#msg87425 date=1091211444]
I'm all for helping but you really need to give it a try for yourself first, then ask us for help, not do it for you.Code:#!/bin/bash telnet <hostname> 259
[/quote]
Gorn, that was initial thought and the script you offered was actually the first thing i tried...it just didn't work. After that I decided to cry for help as at this point my limited knowledge with shell scripting was really exhausted :-)
I should have metioned that I've tried it though.
Bookmarks