Message from discussion
HOW2 find VT of an app. ?
Received: by 10.66.90.36 with SMTP id bt4mr12983919pab.5.1351772777493;
Thu, 01 Nov 2012 05:26:17 -0700 (PDT)
Path: s9ni74107pbb.0!nntp.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.supernews.com!news.supernews.com.POSTED!not-for-mail
NNTP-Posting-Date: Thu, 01 Nov 2012 07:26:15 -0500
From: fl...@apaflo.com (Floyd L. Davidson)
Newsgroups: comp.os.linux.misc,alt.os.linux.debian,alt.os.linux.slackware
Subject: Re: HOW2 find VT of an app. ?
Organization: __________
References: <k6s6na$chn$1@dont-email.me> <46l8m9-mpr.ln1@cjlocal.com>
<87ip9quu5a.fld@pix.apaflo.com> <7ur8m9-tb2.ln1@cjlocal.com>
<874nlaum7q.fld@pix.apaflo.com> <p649m9-3t8.ln1@cjlocal.com>
<ep69m9-74i.ln1@cjlocal.com> <87lielu91g.fld@pix.apaflo.com>
<87hap9u43u.fld@pix.apaflo.com> <j4r9m9-3ra.ln1@cjlocal.com>
<874nl9twq3.fld@pix.apaflo.com> <gr1am9-4ti.ln1@cjlocal.com>
Date: Thu, 01 Nov 2012 04:26:06 -0800
Message-ID: <87zk31se5d.fld@pix.apaflo.com>
User-Agent: Gnus/5.110007 (No Gnus v0.7) XEmacs/21.4.22 (linux, no MULE)
Cancel-Lock: sha1:o/LN5cLt0tG63yIC5f1PQ49m9ds=
MIME-Version: 1.0
Lines: 33
X-Trace: sv3-D9mVJy74A7otxs2UxeN1wZ6vf/x5KVTzQQFbDBPE2QL/h+l3UA6BTXbX6T5hZLFMZV8wSZY4Grchmdq!X2YPE611Hco8cT4xqjoL3klyoT9FzzmTrqwQLF+StZznv+uLYcL+IDSYwuL8nXzkUFY=
X-Complaints-To: www.supernews.com/docs/abuse.html
X-DMCA-Complaints-To: www.supernews.com/docs/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
Bytes: 2536
X-Original-Bytes: 2475
Content-Type: text/plain; charset=us-ascii
"Chris F.A. Johnson" <cfajohn...@gmail.com> wrote:
>On 2012-11-01, Floyd L. Davidson wrote:
>> "Chris F.A. Johnson" <cfajohn...@gmail.com> wrote:
>>>> At this point I don't see any worthwhile way of avoiding
>>>> /bin/ls.
>>>
>>> You can avoid wc as well as ls (assuming bash):
>>>
>>>lc()
>>>{
>>> printf "Count: "
>>> shopt -s nullglob
>>> case $* in
>>> \* | "" ) set -- * ;;
>>> *) set -- "$@" ;;
>>> esac
>>> printf "%d\n" "$#"
>>>}
>>
>> Same problem with the parameter substitution though, with the
>> result that it returns 1 for an empty directory.
>
> It returns 0 in an empty directory
> (that's what 'shopt -s nullglob' is for).
It does work as expected. I must not have had it defined when I
thought it was before.
This one looks by far better than the methods I came up with.
--
Floyd L. Davidson http://www.apaflo.com/floyd_davidson
Ukpeagvik (Barrow, Alaska) fl...@apaflo.com