mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 03:53:32 +01:00
upload.sh: Fix commandline options and added some informational options (-p -x)
This commit is contained in:
parent
50c07354ad
commit
90cee787a0
1 changed files with 23 additions and 6 deletions
|
|
@ -93,6 +93,8 @@ cat << EOT
|
|||
-c variable : show contents of variable
|
||||
valid variables are login, method, passwd, file_owner, file_group, file_mode, dir_mode,
|
||||
source, target_file
|
||||
-p : parse command line into variables, show results and exit if -x switch is active
|
||||
-x : exit after informational commands
|
||||
|
||||
EOT
|
||||
[ -n "$1" ] && exit $1
|
||||
|
|
@ -211,16 +213,20 @@ EOT
|
|||
|
||||
# -- here we go
|
||||
# -- command line arguments
|
||||
set -- `getopt 'hvc:' $*`
|
||||
set -- `getopt 'hvc:px' $*`
|
||||
while [ "$1" != -- ]; do
|
||||
case $1 in
|
||||
h)
|
||||
-h)
|
||||
usage 0;;
|
||||
v)
|
||||
-v)
|
||||
VERBOSE=1;;
|
||||
c)
|
||||
-c)
|
||||
VARIABLE=$2
|
||||
shift;;
|
||||
-p)
|
||||
PARSE=1;;
|
||||
-x)
|
||||
EXIT=1;;
|
||||
*)
|
||||
usage 1;;
|
||||
esac
|
||||
|
|
@ -264,7 +270,7 @@ done
|
|||
# -- real run
|
||||
if [ -n "$VARIABLE" ]; then
|
||||
eval `parse_target`
|
||||
case "$VARABLE" in
|
||||
case "$VARIABLE" in
|
||||
login) echo $login;;
|
||||
method) echo $method;;
|
||||
passwd) echo $passwd;;
|
||||
|
|
@ -278,7 +284,18 @@ if [ -n "$VARIABLE" ]; then
|
|||
echo Unknown variable \"$VARIABLE\". Exiting. >&2
|
||||
exit 1;
|
||||
esac
|
||||
exit 0
|
||||
test "$EXIT" = 1 && exit 0
|
||||
fi
|
||||
|
||||
if [ "$PARSE" = 1 ]; then
|
||||
|
||||
eval `parse_target`
|
||||
|
||||
for var in login method passwd file_owner file_group file_mode dir_mode source target_file ; do
|
||||
|
||||
eval echo $var = \$$var
|
||||
done
|
||||
test "$EXIT" = 1 && exit 0
|
||||
fi
|
||||
|
||||
for t in $*; do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue