/bash debugger

2011-02-27 5 min read bash Linux
9.2. A bash Debugger In this section we’ll develop a very basic debugger for bash.[10] Most debuggers have numerous sophisticated features that help a programmer in dissecting a program, but just about all of them include the ability to step through a running program, stop it at selected places, and examine the values of variables. These simple features are what we will concentrate on providing in our debugger. Specifically, we’ll provide the ability to: Continue reading

bash regular expressions

2011-02-06 1 min read bash
Here are some quick links on bash regular expressions, pretty good links to bookmark, if you use, regular expressions in bash regularly. I especially like the tldp link at number 3. http://www.linuxjournal.com/content/bash-regular-expressions http://www.ibm.com/developerworks/library/l-bash.html http://tldp.org/LDP/abs/html/parameter-substitution.html#VARMATCH http://wellington.pm.org/archive/200005/codegen/index9.htm Related articles Renaming a whole bunch of files at once, in bash (ask.metafilter.com) bash math (amit-agarwal.co.in) Efficiency of regular expressions (johndcook.com) Autogenerate Regular Expressions with txt2re (readwriteweb.com)

Ranking of the most frequently used commands

2011-01-31 2 min read Linux Uncategorized
Lets take a quick look at how to get the most frequently used commands on you shell. So what we need to do is this: 1 <td> <div class="text codecolorer"> history | awk '{print $2}' | awk 'BEGIN {FS="|"}{print $1}' | sort | uniq -c | sort -n | tail | sort -nr </div> </td> </tr> So, how did we arrive at this and will this always work? No it might not always work. Continue reading

fork a new process in perl

2011-01-27 1 min read Uncategorized
I was doing something today and found that I require to fork a new process in perl. Now I had never done this earlier, so I did not know how to do this. First some background : I was doing some program very similar to http server, where the script accepts some input through a socket and then processes the same. In doing so I was seeing that the script was taking some time in processing the input and thus was not processing the second request until the first one was completed. Continue reading

Bash Script Beautifier

2010-12-23 1 min read bash Learning Linux
<dd class="wp-caption-dd zemanta-img-attribution" style="font-size: 0.8em;"> Image via <a href="http://en.wikipedia.org/wiki/File:Bash-org.png">Wikipedia</a> </dd> </dl> Today I was working on a bash script written by someone else. And the script was maintained since long and had actually become quite big and there was no indentation followed. So, you can understand how difficult it was to understand the script. So, I set my foot forth to first find a beautifier for the bash script before I fixed it and my search ended here. Continue reading

Building a Finite State Machine Using DFA::Simple

2010-12-15 11 min read perl
http://www.perl.com/pub/2004/09/23/fsms.html Building a Finite State Machine Using DFA::Simple By Bill Ruppert on September 23, 2004 12:00 AM I am converting some articles from MS Word to HTML by hand. I often use bulleted outlines so I face a lot of work creating lists with nested sub-lists. It didn’t take opening and closing many and tags to realize I wanted to automate the task. It’s very easy to use filters with my text editor and I’ve written several in Perl to speed up my HTML formatting. Continue reading
Older posts Newer posts