Re: Check for existence (style question)
- From: bsh <brian_hiles@xxxxxxxxxxxxxx>
- Date: Wed, 2 Jul 2008 12:16:44 -0700 (PDT)
Janis Papanagnou <Janis_Papanag...@xxxxxxxxxxx> wrote:
RonaldOttoValentinFischer wrote:
...
if ls mydir/*abc* >/dev/null 2>&1
then
echo yes
fi
This would fail on the Unices that have an ls(1) that does
not return non-zero return codes for nonexistent files/
directories; i.e. SunOS4 and others.
set - mydir/*abc*
[ -f "$1" ] && echo Yes
This is not a determinate test. If there is a file named
"*abc*", this test will also fail.
=Brian
.
- Follow-Ups:
- Re: Check for existence (style question)
- From: pk
- Re: Check for existence (style question)
- From: Janis Papanagnou
- Re: Check for existence (style question)
- References:
- Check for existence (style question)
- From: RonaldOttoValentinFischer
- Re: Check for existence (style question)
- From: Janis Papanagnou
- Check for existence (style question)
- Prev by Date: Re: Subtracting months
- Next by Date: Re: Check for existence (style question)
- Previous by thread: Re: Check for existence (style question)
- Next by thread: Re: Check for existence (style question)
- Index(es):
Relevant Pages
|