[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bash -f Test Operator - Not working as expected

From: Greg Wooledge
Subject: Re: Bash -f Test Operator - Not working as expected
Date: Mon, 1 May 2017 09:01:59 -0400
User-agent: Mutt/

On Sat, Apr 29, 2017 at 07:47:06PM -0400, Adam Danischewski wrote:
> $ [[ -L
> "/mnt/samsung32/.word_list_repo/instruments_song_repo/546725_pinstripe.mp3"
> ]] && echo hi
> hi

> $ [[ -f
> "/mnt/samsung32/.word_list_repo/instruments_song_repo/546725_pinstripe.mp3"
> ]] && echo hi
> hi
> It looks like the test operator "-f" is not functioning as described,
> according to the documentation this should only return true on a REGULAR
> file, not a symbolic link.

It returns true for a symbolic link TO a regular file, as documented.


      Conditional expressions are used by the [[ compound  command  and  the
      test and [ builtin commands to test file attributes and perform string
      and arithmetic comparisons.
      Unless otherwise specified, primaries that  operate  on  files  follow
      symbolic  links and operate on the target of the link, rather than the
      link itself.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]