[Techtalk] Joining commands together in bash

Malcolm Tredinnick malcolm at commsecure.com.au
Sun May 11 21:46:52 EST 2003


On Sun, May 11, 2003 at 12:34:07PM +0100, Meredydd wrote:
> This is how I would do it:
> 
> for FILE in * ; do
>   if [ x`file $FILE | grep 'shell script text executable'` != x ]; then
>    head -n 3 $FILE
>   fi
> done

Straight out of the "more than one way to skin a cat" bucket, here is my
solution:

file * | grep 'shell script text executable' | cut -f1 -d':' | xargs head -n 3

Cheers,
Malcolm

-- 
Works better when plugged in.


More information about the Techtalk mailing list