#! /bin/bash
# Script to add all scripts to the main one for dispersion to the right scripts
# Must be run in the sudo mode
if [-z $1] then # Set the dir to scan
scpdir="/default-dir/";
elif
scpdir=$1;
fi
slffil=$scpdir"thisbashfile.sh"; # Ignore this file
if [-z $2] then # Set the target output file
tgtfil=$scpdir"myoutfile"; # Ignore the target file
elif
tgtfil=$2;
fi
for i in `ls $scpdir*.*`; do
# Set iteration skips/continue for: '~', 'html', 'tar' $slffil, $tgtfil
if [ "$i" == "$slffil" ]; then continue; fi
if [ "$i" == "$tgtfil" ]; then continue; fi
case "$i" in [*~] | [*.tar.*] | [*.html] | [*.list] | [*.deb] | [*DRBL])
continue;;
esac;
echo "$i";
done
I need a 3rd "IF" line for the ~
, html
, tar
files in this directory. Should I use a regex for this or is there another simple way to eliminate these files from my dir scan?