
266
|
Appendix: bash Script Samples
r="${r}/${b}"
announce="${d}/${f}"
rsyncopt="-a${checksum}${dryrun}${sparse}vz"
configout "${d}/." "file:${d}/${f}" >"${conffile}"
elif [[ -L "${name}" ]]; then
p=$( exec dirname "${name}" )
b=$( exec basename "${name}" )
d="${p}"
f="${b}"
r=$( cd "${p}" && exec pwd )
r="${r}/${b}"
announce="${d}/${f}"
rsyncopt="-a${checksum}v"
configout "${d}/." "symlink:${d}/${f}" "${f}" >"${conffile}"
fi
#----------------------------------------------------------------
# Show config file if verbose is requested.
#----------------------------------------------------------------
if [[ -n "${verbose}" ]]; then
echo "${bar2}"
ls -ld "${conffile}"
echo "${bar2}"
cat "${conffile}"
fi
#----------------------------------------------------------------
# This function outputs example receive commands.
#----------------------------------------------------------------
function showrsync {
echo -n "rsync ${rsyncopt} "
if [[ -n "${oldfmt}" ]]; then
echo "--port=${port}" $( strquote "${1}::${2}" ) $( strquote "${3}" )
else
echo $( strquote "rsync://${1}:${port}/${2}" ) $( strquote "${3}" )
fi
return
}
#----------------------------------------------------------------
# These functions show rsync commands for hostname and IP address.
#----------------------------------------------------------------
function getip {
case $( exec uname -s ) in
( SunOS )
netstat -i -n | awk '{print $4;}'
;;