On Thu, May 22, 2014 at 4:37 PM, Charles DeRykus <[email protected]> wrote:
> Potentially shorter and arguably simpler if you use the special
> underscore argument to access file info for previous test, eg,
>
> if ( -f $fname and not -l _ ) {
> say...
> }
>
I was just fiddliing w/ that too and, creating a sym link behaves different
than a hard link but:
$ ln nohup.out st
$ perl -e '$fname = "st"; print "yes\n" if ( -l $fname and not -f _ )'
$ perl -e '$fname = "st"; print "yes\n" if ( -f $fname and not -l _ )'
The stat preceding -l _ wasn't an lstat at -e line 1.
$ rm st
$ ln -s nohup.out st
$ perl -e '$fname = "st"; print "yes\n" if ( -l $fname and not -f _ )'
yes
$ perl -e '$fname = "st"; print "yes\n" if ( -f $fname and not -l _ )'
The stat preceding -l _ wasn't an lstat at -e line 1.
Not sure why a "-f" isn't an lstat
$ rm st
$ ln nohup.out st
$ perl -e '$fname = "st"; lstat($fname); print "yes\n" if ( -l _ and not
-f _ )'
$ perl -e '$fname = "st"; lstat($fname); print "yes\n" if ( -f _ and not
-l _ )'
yes
$ rm st
$ ln -s nohup.out st
$ perl -e '$fname = "st"; lstat($fname); print "yes\n" if ( -f _ and not
-l _ )'
$ perl -e '$fname = "st"; lstat($fname); print "yes\n" if ( -l _ and not
-f _ )'
yes
--
a
Andy Bach,
[email protected]
608 658-1890 cell
608 261-5738 wk