ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
#!/bin/bash
# Make sure the folder exists!
if [ -d _BadMaps ] ; then
echo "Good!"
else
echo "JESUS NNOO!!!!!!"
exit 1
fi
# Make sure there is at least one file in there
if [ -f _BadMaps/DM-MetalHell.ut2 ] ; then
echo "Good!"
else
echo "GOD NNOO!!!!!!"
exit 1
fi
# Echo out all files in directory!
for file in _BadMaps/*.ut2 ; do
echo "$file"
done
PERFECT, here's the final script and the part I was working on, I don't need it after I reinstalled UT2004, because all of the maps don't give me the ReadFile EOF lol:
Code:
#!/bin/bash
#
# MAKE SURE THE MAPS GET SENT WHERE THEY SHOULD
# /root/.ut2004/_ProcBad OR /root/.ut2004/_ProcGood
# CREATED BY a Psycho All Rights Reserved
#
#
# TEST MAP
#
testMap()
{
#echo "Currently working on $currentMap"
UT2004_DATA_PATH='/root/.ut2004/System'
cd '/root/.ut2004/System/'
./ut2004-bin > /home/kleid/Programming/Laboratory/loggit.log &
sleep 11
killall ut2004-bin
sleep 2
# Does the map have an error?
#cat /home/kleid/Programming/Laboratory/loggit.log | grep -ic 'Error\|EOF'
if [ `cat /home/kleid/Programming/Laboratory/loggit.log | grep -ic 'EOF\|Error'` = 0 ] ; then
echo "$currentMap is a good map"
mv -uf /root/.ut2004/Maps/$currentMap /root/.ut2004/_ProcGood/$currentMap
else
echo "$currentMap is a bad map"
mv -uf /root/.ut2004/Maps/$currentMap /root/.ut2004/_ProcBad/$currentMap
fi
}
# Make sure the folder exists!
if [ -d /root/.ut2004/_BadMaps ] ; then
echo "Good!"
else
echo "JESUS NNOO!!!!!!"
exit 1
fi
mfiles=`ls -1 /root/.ut2004/_BadMaps`
counter=1
for i in $mfiles ; do
echo "Testing map {$i}..."
mv /root/.ut2004/_BadMaps/$i /root/.ut2004/Maps/$i
currentMap="$i"
testMap
counter=$(($counter+1))
done
echo 'MAP SYNC COMPLETE'
Thanx for the posts guys. You saved me about 2 to 4 hours of work . I was reading through the BASH manual on gnu.org and the way they put it together made reading it worthless to those who are not already advanced users; it is better suited as a reference manual for experts.
Last edited by VectorThorn; 03-18-2009 at 03:35 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.