I'm still getting around the quirks of shell scripting, but I feel like I'm getting a little more comfortable with it.
I've been trying to create an alias to generate a tar file that I have to create frequently, but it always gives me tar errors. Just as a test I tried to create a simple wrapper but it doesn't work either:
function eztar(){
if [ -d $1 ]
then
export QTAR="$1.tar";
tar –cvf ${QTAR} "$1/";
else
echo "Missing directory name";
fi
}
>eztar mydir
tar: invalid option -- ''
Try `tar --help' or `tar --usage' for more information.
Is the -cvf option in this case getting eaten up somehow?
Anyway here'es another one
I had a problem where Apache would run out of memory. I found out that too many failed shutdowns cause the semaphore to get full so to fix that I discovered a script I liked and I tried to get it to run in alias. (BTW is there a better way to do this?) I think I need to put this in a function because when I check the aliases the for loop had expanded to the list of current semaphores, which isnt what I had intended.
alias semfix='eval "for i in `ipcs -s # grep apache # awk '{print $2}'` ; do ipcrm -s $i; done";'
I'm learning I cant just create an alias or wrapper function out of everything on Unix!
