diff options
Diffstat (limited to 'Functions/Zftp')
-rw-r--r-- | Functions/Zftp/zfcd_match | 8 | ||||
-rw-r--r-- | Functions/Zftp/zfdir | 7 |
2 files changed, 11 insertions, 4 deletions
diff --git a/Functions/Zftp/zfcd_match b/Functions/Zftp/zfcd_match index 9159f496c..d977983bf 100644 --- a/Functions/Zftp/zfcd_match +++ b/Functions/Zftp/zfcd_match @@ -25,7 +25,13 @@ if [[ $ZFTP_SYSTEM = UNIX* ]]; then fi # If we're using -F, we get away with using a directory # to list, but not a glob. Don't ask me why. - reply=(${${(M)${(f)"$(zftp ls -lF $dir)"}:#d*}/(#b)*[[:space:]](*)\//$match[1]}) + reply=(${(M)${(f)"$(zftp ls -lF $dir)"}:#d([^[:space:]]##[[:space:]]##)(#c8)?##\/}) + + # If ls -lF doesn't work, try dir ... + if ! (($#reply)); then + reply=(${(M)${(f)"$(zftp dir $dir)"}:#d([^[:space:]]##[[:space:]]##)(#c8)?##}) + fi + reply=(${reply/(#b)d([^[:space:]]##[[:space:]]##)(#c8)([^\/]##)\/#/$match[2]}) # () { # zftp ls -LF $dir >|$1 # reply=($(awk '/\/$/ { print substr($1, 1, length($1)-1) }' $1)) diff --git a/Functions/Zftp/zfdir b/Functions/Zftp/zfdir index 4818dc973..5ec0ebf8c 100644 --- a/Functions/Zftp/zfdir +++ b/Functions/Zftp/zfdir @@ -62,7 +62,7 @@ for (( i = 1; i <= $#argv; i++ )); do fi done -if [[ $# -eq 0 ]]; then +if [[ $# -eq 0 && $redir -ne 1 ]]; then # Cache it in the current directory file. This means that repeated # calls to zfdir with no arguments always use a cached file. if [[ -z $curdir ]]; then @@ -79,11 +79,12 @@ else fi file=$otherdir newargs="$*" - if [[ -f $file && $redir != 1 && $force -ne 1 ]]; then + if [[ -f $file && -n $newargs && $force -ne 1 ]]; then # Don't use the cached file if the arguments changed. + # Even in zfdir -r new_args ... [[ $newargs = $zfconfig[otherargs_$ZFTP_SESSION] ]] || rm -f $file fi - zfconfig[otherargs_$ZFTP_SESSION]=$newargs + [[ -n $newargs ]] && zfconfig[otherargs_$ZFTP_SESSION]=$newargs fi if [[ $force -eq 1 ]]; then |