diff options
Diffstat (limited to 'Functions')
-rw-r--r-- | Functions/Zftp/zfopen | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Functions/Zftp/zfopen b/Functions/Zftp/zfopen index 32b450411..7c7c945d4 100644 --- a/Functions/Zftp/zfopen +++ b/Functions/Zftp/zfopen @@ -7,7 +7,7 @@ emulate -L zsh -local opt dir opt_1 +local opt dir opt_1 setparams while getopts :1 opt; do [[ $opt = "?" ]] && print "zfopen: bad option: -$OPTARG" >&2 && return 1 @@ -35,9 +35,13 @@ if [[ $opt_1 = 1 ]]; then fi else # set parameters, but only if there was at least a host - (( $# > 0 )) && zfparams $* + (( $# > 0 )) && zfparams $* && setparams=1 # now call with no parameters - zftp open || return 1 + if ! zftp open; then + [[ -n $ZFTP_HOST ]] && zftp close + [[ -n $setparams ]] && zfparams - + return 1 + fi fi if [[ -n $dir ]]; then |