Re: File checks

2014-05-22 Thread Manfred Lotz
On Thu, 22 May 2014 16:51:24 -0500 Andy Bach wrote: ... Very interesting experiments. > $ 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. This tells me that if ( -f $fname and not -l _ )' should perhap

Re: File checks

2014-05-22 Thread Manfred Lotz
On Thu, 22 May 2014 14:37:01 -0700 Charles DeRykus wrote: > On Thu, May 22, 2014 at 1:40 PM, Manfred Lotz > wrote: > > Hi there, > > I want to check if a file is a plain file but not a symlink. > > > > It seems because -f returns true for a symlink that I have to do > > this: my $fname = 'somefi

Re: File checks

2014-05-22 Thread Uri Guttman
On 05/22/2014 05:51 PM, Andy Bach wrote: On Thu, May 22, 2014 at 4:37 PM, Charles DeRykus wrote: I was just fiddliing w/ that too and, creating a sym link behaves different than a hard link but: as you should know those are very different animals $ ln nohup.out st $ perl -e '$fname = "st

Re: File checks

2014-05-22 Thread Andy Bach
On Thu, May 22, 2014 at 4:37 PM, Charles DeRykus 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, cre

Re: File checks

2014-05-22 Thread Charles DeRykus
On Thu, May 22, 2014 at 1:40 PM, Manfred Lotz wrote: > Hi there, > I want to check if a file is a plain file but not a symlink. > > It seems because -f returns true for a symlink that I have to do this: > my $fname = 'somefile'; > > if ( -f $fname and not -l $fname ) { > say "$fname is a

File checks

2014-05-22 Thread Manfred Lotz
Hi there, I want to check if a file is a plain file but not a symlink. It seems because -f returns true for a symlink that I have to do this: my $fname = 'somefile'; if ( -f $fname and not -l $fname ) { say "$fname is a plain file"; } Is there a simpler way to do this? -- Manfred