Monday, July 17, 2006

Bash Shell, search for a file

This is not a *nix blog, but the more I work with deploying and managing the deployment of Ajax framework based applications into the same environment I do find myself resorting to Shell scripts.

Example:
I need to find the name of the ear file being deployed

for ent in dist/*
do
if [ "$ent" != "${ent%.ear}" ]
then
echo processing $ent ear file
# take everything from before the .ear input from
# ent variable and store it in app_name
app_name=${ent%.ear}
fi
done

No comments: