M6 – Math

Today is piday Here’s a bash script I saved as “pi” somewhere in $PATH

#!/bin/bash
echo “scale=$1;a(1)*4” | bc -l

I demonstrate it this way:

$ for i in {1..20}; do pi $i; done

2.8
3.12
3.140
3.1412
3.14156
3.141592
3.1415924
3.14159264
3.141592652
3.1415926532
3.14159265356
3.141592653588
3.1415926535896
3.14159265358976
3.141592653589792
3.1415926535897932
3.14159265358979320
3.141592653589793236
3.1415926535897932384
3.14159265358979323844

Unknown's avatar

About Linuxgal

Need a spiritual home? Consider joining us at Mary Queen of the Universe Latter-day Buddhislamic Free Will Christian UFO Synagogue of Vishnu
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a comment