delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/04/05/11:24:54

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Subject: Re: [ILUG] bash script Q
In-Reply-To: <OFEGLPGPCHPACFLJPAILOEMNCOAA.macarthy@iol.ie>
To: macarthy AT iol DOT ie
Date: Fri, 5 Apr 2002 17:31:08 +0100 (IST)
CC: "Ilug AT Linux DOT Ie" <ilug AT linux DOT ie>, cygwin AT cygwin DOT com
MIME-Version: 1.0
Message-Id: <E16tWcG-00037P-00@dspsrv.com>
From: Waider <waider AT dspsrv DOT com>

According to Justin MacCarthy:
> Hi,
> 	anyone point me to the best bash script option for checking the first 2
> characters of all the files in a directory?
> 
> logic of the script is
> 
> for each file in directory
> 	test if the first 2 chars are "%!"
> 		print Filename	valid
> 	if not
> 		print Filename	not valid
> 
> 
> Does magic do something like this ?
> 
> 
> Thanks Justin

Well, I guess file * would tell you they're postscript if they start with "%!"

Or you could use a perl one-liner.

Waider.
-- 
waider AT dspsrv DOT com / Chances are I'm not at home right now.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019