alexander Posted May 10, 2008 Report Posted May 10, 2008 Havent done contests that anyone has really participated in, so this is for real, real contest, real prize (an elitist must-have)!!! Why? Because I can :) Looking for quirky bash lines, you can only post one line, as in a command that upon entering into bash terminal will execute and do something ;) It may pull data from outside sources, it can not call for another bash file though (unless you do it creatively i guess). Winne will get a "BASH Master" tee shirt that i am designing right now, i am in the contest, but not for the win, i want to set bars, etc, to get people to post, and earn the prize. BTW, no excuse for not doing this, bash lines in cedega are just as quirky as linux or os x, so ALL operating systems welcome I will not make this shirt until we have a winner and i know their size, and it will be a limited run (if i decide to make it a run, dunno yet). But trust me, nobody will have the same shirt as you, so... oh i have to say now, you have to post a pic, wearing it, as the winner :) Have at it, i will set the first mark though, this is my basic script for rolling out an update to this package we use:$ nmap --excludefile exclude.txt -sP -n -iL subnets.dat | grep "to be up" | awk '{print "copy serverClient_Kitinstall.bat ", $2, " c$WindowsTempnpsexec -u user -p pass ", $2, "C:Windo wsTempinstall.bat"}' > runme.bat Last thoughts, this is an OPEN contest, you can submit, submit, submit, i will only use the one you choose (upon my pm to you) at the end of the contest. There will be only ONE winner (person who gets a shirt), no loosers though, only participants, so participate, and who knows, you may just win ;) Oh, don't google for a line someone has already posted somewhere and think if you change a couple of things i wont know, WARNING you now, i will disqualify you, publically! Besides, I know your IP....:shrug: Quote
DFINITLYDISTRUBD Posted May 13, 2008 Report Posted May 13, 2008 DANGIT!!!! Wish I knew how to do em!;) (to be perfectly honest I don't even fully understand what the heck bash is!:D) Cool contest though:shrug: Quote
sanctus Posted May 13, 2008 Report Posted May 13, 2008 I thuought I knew a bit the base of bash...seeing your code I figured out that I have way to learn! Quote
alexander Posted May 13, 2008 Author Report Posted May 13, 2008 BASH stands for Born Again SHell, a command language interpreter, that will appear in the GNU operating system. Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). It is intended to conform to the IEEE POSIX P1003.2/ISO 9945.2 Shell and Tools standard. It offers functional improvements over sh for both programming and interactive use. (gnu.org) Ok, you don't have to post lines that use awk or anything like that, just a quirky line... perhaps from something you were working on, or something. Quote
alexander Posted May 13, 2008 Author Report Posted May 13, 2008 reason i used awk is to split the output of the nmap command, into separate arguments and then check for the host being up. awk is a great parsing tool, and that line requires 2 things; subnet.dat file, where you would put like 10.10.100.*.... one subnet = one line, second one is exceptions.txt - which is a file containing exceptions to that scan. I was rolling out a package on all the windows machines at work, but i didn't need to do it on the server, so i threw my server ips in the exceptions, then scanned multiple subnets and generated a file that utilizes psexec (free, command line remote execution tool for windows) and writes a batch file that upon execution would run the invisible, remote install (well install.bat had the procedure for installation) oh i gotta add one more thing to this line too nmap --excludefile exclude.txt -sP -n -iL subnets.dat | grep "to be up" | awk '{print "copy serverClient_Kitinstall.bat " $2 "c$WindowsTempnpsexec -u user -p pass " $2, "C:WindowsTempinstall.bat"}' | Unix2dos > runme.bat ps dont get confused with and the use of commas. In awk, when printing, you need to escape the character, so in order to have 2 slashes, you need to enter 4. And commas will put a space between the text field and the data you are appending, it helps sometimes, but in batch file creation case, i only needed it once. Also i was creating a windows file in a linux-like environment, so you need to convert text standards, so i added a Unix2dos command to do so :tongue: (it converts newline characters to dos standard. dos2unix does the opposite, as you can imagine Quote
alexander Posted May 13, 2008 Author Report Posted May 13, 2008 references:http://tldp.org/LDP/abs/html/An Awk PrimerSed - An Introduction and TutorialGREPLinux Command Reference Quote
alexander Posted June 10, 2008 Author Report Posted June 10, 2008 come on it's like cat !$ you are gonna have to be more creative then thaat... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.