Approaching the end of my portion of some STIG/DOD compliance automation and I was challenged by a co-worker to include a story in my code. There are blocks of code that need to be kept the way they are for GIT/Gerrit and then compliance, but otherwise I changed out all the comments into a not-helpful 300 rendition. I realize the lack of useful comments will make the script a bit harder to manage, and I also realize not everyone will agree with parts of it (Like my hatred for having to take scripts written in bash and then take out the fancy parts so they're portable), but mostly just wanted to share as I was proud of my lack of accomplishment and thought some other folk may get a chuckle out of it.
I kind of drifted a lot and by the end was completely out in the left-field of nonsense. The 300 intro script is way longer than I remembered it being, and I just wanted to get done with this and move on to the next one by the end =]
If other folks have similar things they've nested into scripts, would like to see; if this is too off-topic and gets blasted by a mod as such, my bad m(_ _)m
Code:
# cat GEN004580.sh |grep '^[\ ]*#'
#/bin/sh
#######################################################################################################
#
# Package : XCCDF Scripts
# bc_description :
# bc_filename : GEN004580.sh
# bc_client_loc : /usr/local/scripts/xccdf/gen/
# bc_platform : all
# bc_owner : root|root
# bc_perms : 0500
# bc_host : all
#
# Company : XXXXXXX
# Author : XXXXXX
# Revision : 1
#
#######################################################################################################
#######################################################################################################
#
# CHANGELOG
#
# Jul 24 2012 : First version
#
#######################################################################################################
#######################################################################################################
# XCCDF Definitions
#######################################################################################################
#######################################################################################################
# Header Definitions/Initializations
#######################################################################################################
## When the script was born.
## Like all scripts, it was inspected.
## if it has been malwritten
## or unmanageable, or inefficient, or written only in bash
## It would have been discarded
#######################################################################################################
# Begin testing.
#######################################################################################################
## From the first execution, it was baptised in the fire of bourne shell.
## Taught never to be incompatible.
## Never to run only on one version of Unix.
## Taught that proper error checking -- striving in service to efficiency.
## Is the greatest glory any script can ever achieve.
## Upon completion of any script, as customary in shell scripting.
## The script is taken from it's testing ground and plunged into a world of debugging.
## Manufactured by 40 years.
## a Spartan programming society.
## To create the finest shell scripts the world has ever known.
## The agoge is its goal.
## It forces the scripter to fight -- Breaks him.
## It forces him to google
## and if necessary, to mIRC
## By sed, awk, and grep
## The scripter is punished.
## Taught to show no emotion, to indent without mercy.
## Hunting to be tested, tossed into the basest of shells.
## Left to pit his will and mind against understanding a regular expressions fury.
## It is his initiation, his time in the bourne shell.
## For he will return with compliant code, or not at all.
## The task begins to encompass the scripter
## To run circles 'cross his mind.
## Simple commands that run awry - segmentation faults deep into the night.
#######################################################################################################
# Fix open issue if appropriate
#######################################################################################################
## Text pulsing green
## Envy of a windows admin (who can't spell keyboard).
## The Solaris box laughing
## Savoring the keystrokes of a pending kernel panic.
## Only a heightened sense of things.
## The Dr. Pepper at his side
## An alabaster tan.
## His hands are steady.
## His syntax: Perfect.
## And so the scripter, given up as a lost cause
## Finishes his task, and returns to his people.
## In the IT circles, a king.
## A unix admin.
## Modern day Leonidas!
## It's been more than 40 years
## Since the inception of proprietary code
## Now as then, the beast approaches.
## Patient and confident, savoring the out-sourcing to come
## The beast is made of men and dollar signs - corporate lawyers and venture capitalists
## An army of Overseers, rich beyond imagining.
## Ready to snuff out non-compiled code, any hope for sharing and openness.
## This beast approaches, hiding behind proprietary automation and ease of use.
## It was freedom itself that provoked it.
Hey all,
I'm trying to setup an external XML feed for my site and I've received a script to make it all possible. This script places the feed in the MySQL datbasa and can remove the previous feed. Because I am new to this I would like to ask a simple question. Could somebody tell me where do I... (3 Replies)
I must write a script to change all C++ like comments:
// this is a comment
to this one
/* this is a comment */
How to do it by sed? With file:
#include <cstdio>
using namespace std; //one
// two
int main() {
printf("Example"); // three
}//four
the result should be: (2 Replies)
#!/usr/bin/ksh
ls -l $@ | awk '
/^-/ {
l = 5*log($5)
h = sprintf("%7d %-72s",$5,$8)
print "\x1B
ls command with histogram of file sizes.
The histogram scale is logaritmic, to avoid very short bars for smaller files or very long bars for bigger files.
Screenshot: (4 Replies)
uggc://ra.jvxvcrqvn.bet/jvxv/EBG13
#!/usr/bin/awk -f
BEGIN {
for (n=0;n<26;n++) {
x=sprintf("%c",n+65); y=sprintf("%c",(n+13)%26+65)
r=y; r=tolower(y)
}
}
{
b = ""
for (n=1; x=substr($0,n,1); n++) b = b ((y=r)?y:x)
print b
}
... (0 Replies)
Hi All,
Please let me know how I can put a comment (e.g // or #) to more than 50 lines using vi editor in a .cpp/.sh file.
Thanks in advance. (3 Replies)
I have written a script to start websphere server, I dont know where to put
the file in the OS . please put me the place to put the starup scripts in linux, solaris and AIX? (2 Replies)
This could be a really dumb question, but for a newbie trying to learn, some help would be appreciated. When you write a shell script, what extension should it have, and more importantly, where do you put it???? (7 Replies)