FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

 
 
LinkBack Thread Tools
 
Old 11-15-2010, 05:47 PM
Kill Script
 
Default good shell script examples?

I am looking for a beginner guide to shell scripting simple tasks on CentOS (e.g. ssh'ing into a server / router / switch, checking for certain things, then exiting and going to the next IP).
Does anyone have any suggestions on where to look? *(I'm relatively new to bash)
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 11-15-2010, 05:54 PM
Max Hetrick
 
Default good shell script examples?

On 11/15/2010 01:47 PM, Kill Script wrote:
> I am looking for a beginner guide to shell scripting simple tasks on
> CentOS (e.g. ssh'ing into a server / router / switch, checking for
> certain things, then exiting and going to the next IP).
>
> Does anyone have any suggestions on where to look? (I'm relatively new
> to bash)

The book Learning the bash Shell helped me out a lot.

http://oreilly.com/catalog/9781565923478

Regards,
Max
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 11-15-2010, 06:22 PM
John Kennedy
 
Default good shell script examples?

On Mon, Nov 15, 2010 at 13:54, Max Hetrick <maxhetrick@verizon.net> wrote:


On 11/15/2010 01:47 PM, Kill Script wrote:

> I am looking for a beginner guide to shell scripting simple tasks on

> CentOS (e.g. ssh'ing into a server / router / switch, checking for

> certain things, then exiting and going to the next IP).

>

> Does anyone have any suggestions on where to look? *(I'm relatively new

> to bash)



The book Learning the bash Shell helped me out a lot.



http://oreilly.com/catalog/9781565923478



Regards,

Max

To answer your question, I have liked UNIX Shells By Example by Ellie Quigley (4th edition) it has good examples with*explanations. The Linux Command line and Shell Scripting Bible is a good teaching tool. A new edition is due out next year but the current edition is still useful.


As to what you appear to want to do, if you require interactive logins (i.e. ssh keys not set up for password-less logins) then bash is not the best choice. For this you would want to use either Python (with pyexpect module) or the Expect scripting language (Expect is an extension of the TCL scripting language.


John
--
*John Kennedy



_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 11-15-2010, 06:24 PM
Scott Robbins
 
Default good shell script examples?

On Mon, Nov 15, 2010 at 04:47:02PM -0200, Kill Script wrote:
> I am looking for a beginner guide to shell scripting simple tasks on CentOS
> (e.g. ssh'ing into a server / router / switch, checking for certain things,
> then exiting and going to the next IP).
>
> Does anyone have any suggestions on where to look? (I'm relatively new to
> bash)


I have a page where I've posted what I've found to be useful links.


http://home.roadrunner.com/~computertaijutsu/shellscripting.html


--
Scott Robbins
PGP keyID EB3467D6
( 1B48 077D 66F6 9DB0 FDC2 A409 FA54 EB34 67D6 )
gpg --keyserver pgp.mit.edu --recv-keys EB3467D6

Spike: A slayer with family and friends. That sure as hell wasn't
in the brochure.

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 11-15-2010, 07:38 PM
Sven Aluoor
 
Default good shell script examples?

On Mon, Nov 15, 2010 at 7:54 PM, Max Hetrick <maxhetrick@verizon.net> wrote:
> The book Learning the bash Shell helped me out a lot.
>
> http://oreilly.com/catalog/9781565923478

Classic online learning guide is "Advanced Bash-Scripting Guide"

http://tldp.org/LDP/abs/html/

(I use it as reference, downloaded a PDF version)

cheers Sven
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 11-15-2010, 08:47 PM
Spiro Harvey
 
Default good shell script examples?

> Does anyone have any suggestions on where to look? (I'm relatively
> new to bash)


http://www.google.com/search?q=bash+tutorial has quite a few.

I wrote a simple one a few years back:

http://www.happyhacker.org/gtmhh/basha.shtml


--
Spiro Harvey Knossos Networks Ltd
(04) 460-2531 : (021) 295-1923 www.knossos.net.nz
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 11-16-2010, 01:06 AM
Kill Script
 
Default good shell script examples?

I wrote a simple one a few years back:
> http://www.happyhacker.org/gtmhh/basha.shtml

This is great! Thanks for sharing.
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 11-16-2010, 08:14 AM
Gabriel Tabares
 
Default good shell script examples?

On 15/11/2010 18:47, Kill Script wrote:
> I am looking for a beginner guide to shell scripting simple tasks on
> CentOS (e.g. ssh'ing into a server / router / switch, checking for
> certain things, then exiting and going to the next IP).

If you don't want to use ssh keys, you will have to write scripts that
interact with prompts, so you'll probably be looking at Expect, Python
(pexpect or paramiko) or Perl.

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 11-16-2010, 09:32 AM
Kill Script
 
Default good shell script examples?

Gabriel Tabares wrote:
> If you don't want to use ssh keys, you will have to write scripts that
> interact with prompts, so you'll probably be looking at Expect, Python
> (pexpect or paramiko) or Perl.

In one case, this is what I have to do for some networking hardware. I
have to ssh in, run a command, and then analyze the output. I'm not
quite sure how to do this given Perl / Python / Expect / etc and am
hoping to find some good examples online that can help me get started.
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 11-17-2010, 06:47 AM
"洪 川"
 
Default good shell script examples?

#!/bin/bash
H="
192.168.1.1192.168.1.2192.168.1.3192.168.1.4"
for i in $H ; do** *expect << -EOF-set timeout 2spawn scp ${rootidfile} root@${host}:/tmp/id_fileexpect "d:"send "${password}
"expect eofspawn ssh ${host}expect "d:"send "${password}
"expect "#"send "mkdir -p /root/.ssh; chmod 700 /root/.ssh
"expect "#"send "cat /tmp/id_file >> /root/.ssh/authorized_keys
"expect "#"send "rm -f /tmp/id_file; exit
"expect eof-EOF-done

http://www.bsdmap.com/2010/11/06/ssh-shell-script/**------------------*Original*------------------From: *"Kill Script"<killscript@gmail.com>;Date: *Tue, Nov 16, 2010 02:47 AMTo: *"centos"<centos@centos.org>; Subject: *[CentOS] good shell script examples?*I am looking for a beginner guide to shell scripting simple tasks on CentOS (e.g. ssh'ing into a server / router / switch, checking for certain things, then exiting and going to the next IP).
Does anyone have any suggestions on where to look? ?(I'm relatively new to bash)

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 

Thread Tools




All times are GMT. The time now is 12:07 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org