[ssh_tools] multicopy: formatting, typos, usage
This commit is contained in:
parent
0e865d9025
commit
8ae30d5e91
|
@ -26,15 +26,20 @@ print_usage()
|
||||||
{
|
{
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
Usage:
|
Usage:
|
||||||
$0 [-P] [-r|-R] [-l login] <hosts_list> <file1> [file2 [...]]
|
$0 -h
|
||||||
|
$0 [-P] [-r|-R] [-l <login>] <hosts_list> <file1> [file2 [...]]
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-h Print this help message.
|
-h Print this help message.
|
||||||
|
-l <login>
|
||||||
|
Login remotely as <login>.
|
||||||
-P Transfer files in parallel instead of one by one whenever possible
|
-P Transfer files in parallel instead of one by one whenever possible
|
||||||
(ignored when -r or -R is used).
|
(ignored when -r or -R is used).
|
||||||
-r Use prsync instead of pscp.
|
-r Use prsync instead of pscp.
|
||||||
-R Use prsync's --delete option (delete remote files that are not in
|
-R Use prsync's --delete option (delete remote files that are not in
|
||||||
the local copy).
|
the local copy).
|
||||||
|
|
||||||
|
<hosts_list> is the list of remote hosts on which the file(s) will be copied.
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,15 +81,11 @@ done
|
||||||
shift $((OPTIND - 1))
|
shift $((OPTIND - 1))
|
||||||
|
|
||||||
# Do we still have at least a host list and a file?
|
# Do we still have at least a host list and a file?
|
||||||
if [ $# -lt 2 ] ; then
|
[ $# -lt 2 ] && bad_usage "Wrong number of arguments."
|
||||||
bad_usage "Wrong number of arguments."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check the usage of -r and -R
|
# Check the usage of -r and -R
|
||||||
if [ "$DELETE" = "1" ] ; then
|
if [ "$DELETE" = "1" ] ; then
|
||||||
if [ "$RSYNC" = "1" ] ; then
|
[ "$RSYNC" = "1" ] && bad_usage "Use either -r or -R, but not both."
|
||||||
bad_usage "Use either -r or -R, but not both."
|
|
||||||
fi
|
|
||||||
RSYNC=1
|
RSYNC=1
|
||||||
DELETE="-X --delete"
|
DELETE="-X --delete"
|
||||||
fi
|
fi
|
||||||
|
@ -113,16 +114,14 @@ if [ -z "$MULTIPING" ] ; then
|
||||||
exit $EXIT_DEPENDENCY
|
exit $EXIT_DEPENDENCY
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Hosts' list file
|
# Hosts list file
|
||||||
HOSTS_LIST_NAME="$1"
|
HOSTS_LIST_NAME="$1"
|
||||||
if [ -z ${XDG_CONFIG_HOME+x} ] ; then
|
|
||||||
XDG_CONFIG_HOME="$HOME/.config"
|
|
||||||
fi
|
|
||||||
HOSTS="$XDG_CONFIG_HOME/ssh_tools/${HOSTS_LIST_NAME}.lst"
|
|
||||||
shift
|
shift
|
||||||
echo "Using file '$HOSTS' as hosts' list."
|
[ -z ${XDG_CONFIG_HOME+x} ] && XDG_CONFIG_HOME="$HOME/.config"
|
||||||
|
HOSTS="$XDG_CONFIG_HOME/ssh_tools/${HOSTS_LIST_NAME}.lst"
|
||||||
|
echo "Using file '$HOSTS' as hosts list."
|
||||||
if [ ! -f "$HOSTS" ] ; then
|
if [ ! -f "$HOSTS" ] ; then
|
||||||
err "The hosts' list file doesn't exist or is not a regular file."
|
err "The hosts list file doesn't exist or is not a regular file."
|
||||||
exit $EXIT_HOSTS_LIST
|
exit $EXIT_HOSTS_LIST
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue