[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROG] BASH fil-type check...



On Sat, Aug 10, 2002 at 11:04:02PM +0200, Thomas Williams wrote:
> Er der nogen nem måde finde ud af om en fil er binær eller text, i sine
> shell scripts. F.eks. på samme måde som man checker om en fil findes.
> 
> if [ -f FILE]; then
>   .....
> fi

if file $file|grep -q text; then
	echo "$file is a text file."
else
	echo "$file is a binary file."
fi

-- 
Best Regards
Emil S. Hansen - sslug@sslug - ESH14-DK
UNIX Administrator, Berlingske IT - www.bit.dk
PGP: 109375FA/ABEB 1EFA A764 529E 82B5  0943 AD3B 1FC2 1093 75FA

"tjaa men ville disse lister ikke være kedelige hvis vi altid gav
hinanden ret med det samme :o)" - Kim Schulz på SSLUG.PROG


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 19:58 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *