Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 May 2001 19:31:09 -0600 (CST)
From:      Ryan Thompson <ryan@sasknow.com>
To:        freebsd-questions@freebsd.org
Subject:   Better way to get link count from shell?
Message-ID:  <Pine.BSF.4.21.0105161926480.75285-100000@ren.sasknow.com>

next in thread | raw e-mail | index | archive | help

Hey everybody...

Maybe it's the summer heat. Is there any preferred method to getting the
link count of a file from the shell (any shell), i.e., in a shell script?

I'm using 
		/bin/ls -lda $filename | awk '{print $2}'
but that, while convenient, is perhaps a bit clunky. Maybe it's the way to
go, though. I don't really see any portability issues.

I suppose the alternative would be to code a quick C program, but that
seems equally clunky (if a bit faster in a loop).

Am I missing anything obvious here?

Thanks,
- Ryan

-- 
  Ryan Thompson <ryan@sasknow.com>
  Network Administrator, Accounts

  SaskNow Technologies - http://www.sasknow.com
  #106-380 3120 8th St E - Saskatoon, SK - S7H 0W2

        Tel: 306-664-3600   Fax: 306-664-1161   Saskatoon
  Toll-Free: 877-727-5669     (877-SASKNOW)     North America


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0105161926480.75285-100000>