[KLUG Members] calling functions from the shell
bill
members@kalamazoolinux.org
Mon, 09 Dec 2002 15:29:01 -0500
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
}