1 |
On 11/29/2014 03:30 AM, Michał Górny wrote: |
2 |
> Check whether a particular bashrc path is not a directory before trying |
3 |
> to source it. Avoids unnecessary 'is a directory' errors. |
4 |
> --- |
5 |
> bin/ebuild.sh | 2 +- |
6 |
> 1 file changed, 1 insertion(+), 1 deletion(-) |
7 |
> |
8 |
> diff --git a/bin/ebuild.sh b/bin/ebuild.sh |
9 |
> index 658884a..46c3a03 100755 |
10 |
> --- a/bin/ebuild.sh |
11 |
> +++ b/bin/ebuild.sh |
12 |
> @@ -421,7 +421,7 @@ __try_source() { |
13 |
> qa=false |
14 |
> shift |
15 |
> fi |
16 |
> - if [[ -r "$1" ]]; then |
17 |
> + if [[ -r $1 && ! -d $1 ]]; then |
18 |
> local debug_on=false |
19 |
> if [[ "$PORTAGE_DEBUG" == "1" ]] && [[ "${-/x/}" == "$-" ]]; then |
20 |
> debug_on=true |
21 |
> |
22 |
|
23 |
LGTM. Maybe [[ -r $1 && -f $1 ]] makes more sense though, since anything |
24 |
other that a regular file will simply not work here (-f returns true for |
25 |
symlinks to regular files, too). |
26 |
-- |
27 |
Thanks, |
28 |
Zac |