Linux Newbie help
 help / color / mirror / Atom feed
* Bash Scripts
@ 2002-10-10 20:34 Paul Kraus
  2002-10-10 21:13 ` Don Petrowski
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Paul Kraus @ 2002-10-10 20:34 UTC (permalink / raw)
  To: linux-newbie

[-- Attachment #1: Type: text/plain, Size: 976 bytes --]

I have a script that mounts an samba shared drive, copies the contents
if newer to the Linux box, and then umounts the share.

Sample script
---
mount -t smbfs -o username=x,password=y //machine/share /mnt/network
cp --recursive --preserve --verbose --parents --update /mnt/network/*
/backup/machine \
	> log1.txt 2>log2.txt
umount /mnt/network
------------
End script

A couple of easy questions I can't seem to find answers to.
1. How can I pass in parameters from the command line to use as
variables. 
	myscript value1 value2
2. How can I have it dump a message to a log file if something fails and
then cease running the script. 
	if mount fail append to end of log1.txt "mounting failed",
terminate script.

I was under the impression that you could have a script terminate if a
command failed by having && separate the commands but this just
generates an error.

Paul Kraus
Network Administrator
PEL Supply Company
216.267.5775 Voice
216-267-6176 Fax
www.pelsupply.com

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Paul Kraus (pkraus@pelsupply.com).vcf --]
[-- Type: text/x-vcard; name="Paul Kraus (pkraus@pelsupply.com).vcf", Size: 592 bytes --]

BEGIN:VCARD
VERSION:2.1
N:Kraus;Paul
FN:Paul Kraus (pkraus@pelsupply.com)
ORG:PEL Supply Company
TITLE:Network Administrator
TEL;WORK;VOICE:(216) 267-5775
TEL;CELL;VOICE:(216) 410-5526
TEL;WORK;FAX:(216) 267-6176
ADR;WORK:;;4666 Manufacturing Road;Cleveland;Ohio;44135;United States of America
LABEL;WORK;ENCODING=QUOTED-PRINTABLE:4666 Manufacturing Road=0D=0ACleveland, Ohio 44135=0D=0AUnited States of Ame=
rica
ADR;HOME:;;;;;;United States
LABEL;HOME:United States
URL;WORK:http://www.pelsupply.com
EMAIL;PREF;INTERNET:pkraus@pelsupply.com
REV:20020416T182124Z
END:VCARD

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-10-10 21:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-10 20:34 Bash Scripts Paul Kraus
2002-10-10 21:13 ` Don Petrowski
2002-10-10 21:16 ` Ray Olszewski
2002-10-10 21:33 ` Don Petrowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox