[PLUG] [TOOL-Release] TMAC for Linux

Kulkarni Shantanu linux at shantanukulkarni.org
Fri May 7 14:29:30 IST 2010


* Sagar Belure <sagar.belure at gmail.com> [100507 13:27]:
> So, this is it. I'm really happy to release this tool and little curious
> though, to receive the suggestions from you people and any kind of feedback
> would be appreciable.
> I know, there must be lot more improvements to make it work better.
> So, this is my request all of Linux users, please try this once at least and
> send me your suggestions/feedback.
> I really would like to hear ANY kind of feedback about it, doesn't matter,

Thanks for the efforts. I was looking for just this kind of tool just
yesterday.
Since you invited _any_ kind of feedback, here is some of my feedback
about scripting style (purely personal). Please take it as positive
criticism.

a. This is a bash script, right? I would prefer it to be called tmac.bash.
b. Since it is bash script, why not make use of [[...]] instead of
[...]. This will save a lot of quoting and also safeguard in case you
forget to quote (like on line 98). Also, why not == instead of =? (I
know that = is portable and POSIX compliant - but this is a bash script,
so you can make use of bash features).
c. I feel some unnecessary commands can be weeded out like on lines 81,
82, 83, 113, 119 etc. e.g.
grep '...' | wc can be grep -c '...'
ifconfig | grep ... | awk can be ifconfig | awk '/.../ {.....}' 
grep | head | tail | cut | awk  can be written in one awk statement.
Well, you know what I mean.
d. I would personally use printf instead of the (maybe) non-portable
echo -e and echo -n switches.
e. Let your exit return values, so we know at which point it failed.
f. let "i+=1", is it really portable or should you stick with let i=i+1
c. Be aware that some Linux systems (atleast a few years back) didn't
install bc by default. I guess using awk to do the calculations can do
the trick or atleast check for existence of bc.

I am yet to use the script. I will give some more feedback later if I
find something interesting or wrong.

Thanks,
Shantanu
www.shantanukulkarni.org
-- 




More information about the Plug-mail mailing list