#!/bin/bash shopt -s extglob for file in !(*gz) do if ((file!=$0)) echo $file fi done echo $0