Ask Dave Taylor
  • Facebook
  • Instagram
  • Linkedin
  • Pinterest
  • Twitter
  • YouTube
  • Home
  • YouTube Videos
  • Top Categories
  • Subscribe via Email
  • Ask A Question
  • Meet Dave
  • Home
  • Linux Shell Script Programming
  • Nifty shell script of the day: calculating standard deviation

Nifty shell script of the day: calculating standard deviation

May 7, 2004 / Dave Taylor / Linux Shell Script Programming / No Comments

If you find yourself working on the command line and need to whip out a quick statistical analysis or two, you’ll be glad to know that Wicked Cool Shell Scripts fan Josh Kotecha has sent in a very nice little shell script that does just that using the scriptbc script included in the book.

Here’s his script, as written:

#!/bin/sh
# copyright(c) j. kotecha 2004 -- http://www.vidia.com/
# this file may be used without fee as long as the copyright
# notice is kept the program is is "as is" and not warranted
# for any purpose. Use at your own risk
M="0"
s="0"
v="0"
d="0"
if [ $# -eq 0 ]; then
exit 1
fi
if [ $1 = "-m" ]; then
M=$2
shift 2
else
M=0
fi
list=$*
count=$#
for i in $*
do
d=`scriptbc -p 9 $i - $M`
v=`scriptbc -p 9 $d \* $d`
s=`scriptbc -p 9 $s + $v`
done
std="`scriptbc -p 9 $s / $count`"
std="`scriptbc -p 9 sqrt \( $std \)`"
echo $std

The script itself could be fine-tuned a bit, but the important thing to see here is that Wicked Cool Shell Scripts really does enable readers to get more out of the command line and shell scripting environment, to create scripts and commands that they otherwise wouldn’t have been able to create.

Great job, Josh!

Let’s Stay In Touch!

Never miss a single article, review or tutorial here on AskDaveTaylor, sign up for my fun weekly newsletter!
Name: 
Your email address:*
Please enter all required fields
Correct invalid entries
No spam, ever. Promise. Powered by FeedBlitz
Please choose a color:
Starbucks coffee cup I do have a lot to say, and questions of my own for that matter, but first I'd like to say thank you, Dave, for all your helpful information by buying you a cup of coffee!

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Search

Recent Posts

  • How Do I Create a Custom Search Engine in Microsoft Edge?
  • How to Scan QR Codes on Saved Photos (iPhone & Android)?
  • What Can I Tweak on my PC to Make it Left Handed Friendly?
  • How Do I “Unshare” a Shared iCal Calendar on my Mac?
  • Best Way to Change Movie Poster Art on Plex Media Player?

On Our YouTube Channel

AIRHUG Portable Bluetooth Speakerphone -- DEMO & REVIEW

MIFO S IP67 Sport ANC Earbuds -- REVIEW

Categories

  • AdSense, AdWords, and PPC Help (106)
  • Amazon, eBay, and Online Shopping Help, (161)
  • Android Help (193)
  • Apple iPad Help (144)
  • Apple Watch Help (51)
  • Articles, Tutorials, and Reviews (344)
  • Business Advice (198)
  • Chrome OS Help (20)
  • Computer & Internet Basics (755)
  • d) None of the Above (164)
  • Facebook Help (381)
  • Google, Chrome & Gmail Help (175)
  • HTML & Web Page Design (244)
  • Instagram Help (47)
  • iPhone & iOS Help (601)
  • iPod & MP3 Player Help (173)
  • Kindle & Nook Help (90)
  • LinkedIn Help (85)
  • Linux Help (162)
  • Linux Shell Script Programming (86)
  • Mac & MacOS Help (886)
  • Most Popular (16)
  • Outlook & Office 365 Help (24)
  • PayPal Help (69)
  • Pinterest Help (53)
  • Reddit Help (16)
  • SEO & Marketing (81)
  • Spam, Scams & Security (92)
  • Trade Show News & Updates (23)
  • Twitter Help (217)
  • Video Game Tips (66)
  • Web Site Traffic Tips (62)
  • Windows PC Help (908)
  • Wordpress Help (204)
  • Writing and Publishing (72)
  • YouTube Help (45)
  • YouTube Video Reviews (159)
  • Zoom, Skype & Video Chat Help (56)

Archives

Social Connections:

Ask Dave Taylor


Follow Me on Pinterest
Follow me on Twitter
Follow me on LinkedIn
Follow me on Instagram


AskDaveTaylor on Facebook



microsoft insider mvp


This web site is for the purpose of disseminating information for educational purposes, free of charge, for the benefit of all visitors. We take great care to provide quality information. However, we do not guarantee, and accept no legal liability whatsoever arising from or connected to, the accuracy, reliability, currency or completeness of any material contained on this site or on any linked site. Further, please note that by submitting a question or comment you're agreeing to our terms of service, which are: you relinquish any subsequent rights of ownership to your material by submitting it on this site. Our lawyer says "Thanks for your cooperation."
© 2022 by Dave Taylor. "Ask Dave Taylor®" is a registered trademark of Intuitive Systems, LLC.
Privacy Policy - Terms and Conditions - Accessibility Policy