1 |
On 08/08/18 22:34, Michał Górny wrote [excerpted]: |
2 |
> +# Example: |
3 |
> +# @CODE |
4 |
> +# if path_exists "${ROOT}"/etc/foo.d/*.conf; then |
5 |
> +# do_something |
6 |
> +# fi |
7 |
> +# @CODE |
8 |
> path_exists() { |
9 |
> - local opt=$1 |
10 |
> - [[ ${opt} == -[ao] ]] && shift || opt="-a" |
11 |
> - |
12 |
> - # no paths -> return false |
13 |
> - # same behavior as: [[ -e "" ]] |
14 |
> - [[ $# -eq 0 ]] && return 1 |
15 |
> - |
16 |
> - local p r=0 |
17 |
> - for p in "$@" ; do |
18 |
> - [[ -e ${p} ]] |
19 |
> - : $(( r += $? )) |
20 |
> + local p |
21 |
> + for p; do |
22 |
> + [[ -e ${p} ]] && return 0 |
23 |
> done |
24 |
You seem to have lost the inclusion of the function parameters in the |
25 |
execution code - was this intentional?! |
26 |
Regards, |
27 |
Michael. |