[KLUG Members] calling functions from the shell

bill members@kalamazoolinux.org
Mon, 09 Dec 2002 15:53:35 -0500


OK, no commas, no parentheses.  Tres bien.

thanks,

bill



Bruce Smith wrote:

> > If I create the following file and mark it executable how would I call the
> > function?
> >
> > #!/bin/bash
> >
> >          BACKDIR= /backup
> >          WINCMD= /usr/bin/smbclient
> >
> >          function CopyWinHost(){
> >
> >          # tars and gzips "windows shares" to a local directory using samba's
> >          # smbclient
> >          # argument 1 is the remote host window's host name
> >          # argument 2 is the share name to be backed up
> >
> >             echo $1,$2,$3
> >             REMOTE= $1
> >             SHARE= $2
> >             DEST= $3
> >
> >           # create a tarred gzip file using samba to copy direct from a
> >           # windows pc
> >           # 12345 is a password.  Needs some password even if not defined on
> >           # remote system
> >             $WINCMD \\\\$REMOTE\\$SHARE 12345 -Tc -|gzip > $DEST
> >             echo `date`": Done backing up "$REMOTE" to "$DEST
> >             echo
> >          }
>
> CopyWinHost one two three
>
> --------------------------------------------
> Bruce Smith                bruce@armintl.com
> System Administrator / Network Administrator
> Armstrong International, Inc.
> Three Rivers, Michigan  49093  USA
> http://www.armstrong-intl.com/
> --------------------------------------------
>
> _______________________________________________
> Members mailing list
> Members@kalamazoolinux.org
>