random picking scripts inside a script
ok i run a server fro 4 of my mates on my linux box thes two scripts i use to start the server the first is irrelevent as its the stats server the second is the focus of my attention and the one that needs help with
Code:
#!/bin/sh i create 10 scripts maybe more each identicle except for the +map bit that would have a different map name in each then one script that picks 1 script at random to run out of the 10 but i dont even know if thats possible im guessing if commands maybe even a random command i just dont know the other alternative is a bit more complicated but i think may work ; get script to delete a tempory script first (the reason will be clear later) then pick from a list of map names one map name and to record that name to a string (i think thats the name) then create a tempory script file and echo in all of the details in the top script except were +map as_oilrig_wk is it would place the string contents im hoping someone out theree is reading this and thinking "interesting" or better yet "easy" maybe im asking to much of the linux shell system but it all seems doable in a theory sense i just dont have the knowledge to do it |
Quote:
bash supports both arrays and random numbers. You can do it all in one simple script: Code:
#!/bin/bash |
You can do it all in one simple script
Simple is cool, definately. Anyway. Here's my take on it. It's simple, really: Code:
#!/bin/sh |
man you guys are quick i thought i`d have a quick check before me and the missus settle down to a film
i love the mapdir method but unfortunly the map dir has various other files and folders inside it so the script would have to look only at the *.bsp only then remove the .bsp when it inserts it into the correct place so were into the realms of the silly again the fist option seems better as i could choose what maps have the odds of being the start map and i assume i can have an indeffinate number of maps in the array thank you thank you guys i`m going to try this after the film and will edit or reply to say if it worked or not though i cant see why it wouldnt |
Quote:
Code:
#!/bin/bash See the find and basename manpages for more information. |
Code:
#!/bin/sh |
All times are GMT -5. The time now is 10:58 PM. |