Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [Fwd: Parameter Expansion questions]



"David R. Favor" <dfavor@xxxxxxxxxxxxxx> writes:

>    # paths to search
>    editpath=${EDITPATH:-"$PATH:$CDPATH"}
> 
>    IFS=:
> 
>    if [ $shell_type = 'zsh' ] ; then   <<< $shell_type
>       editpath=${editpath:gs/:/ /}
>    else
>       editpath=$editpath
>    fi
> 
>    IFS="$BACKUP_IFS"
> 
>    for name in $* ; do
> 
>       for dir in ${=editpath} ; do     <<< ${=editpath}
> 
>          # find/edit the file
> 
>       done
> 
>    done

How about replacing

	editpath=${editpath:gs/:/ /}

with

	editpath=(${=editpath})

i.e., you create editpath as an array, which allows the loop to be the
same in ksh and zsh:

	for dir in $editpath; do

That doesn't remove the need for the shell choice earlier, however.



Messages sorted by: Reverse Date, Date, Thread, Author