I met my lovely wife through a concert provided by the estimable Pat Matheny. I love what he does – but, more, I love who my bride is.
Here is another worthy compatriot in the jazz guitar world:
Chris Juergensen
As a System Engineer the command line is where I live most of the time. So having a quick means of calculating is needed.
The tool “bc” (think: binary calculator) is your friend here but you must be aware of the -l option. I often use one of two methods. For a series of calculations I will use “bc -l”. The -l option will include the standard math libraries (my reasoning here is an over simplification: it allows floating point results).
I have an alias in my (extensive) .bashrc script that looks like this:
alias bcl="bc -l"
This allows me to quickly establish a live calculator by typing “bcl” and when I am finished hit Ctrl-D
The second method still uses “bc” but is a function in my .bashrc script called calcit. Note that within the comments I provide a way to do this in perl as well.
########
calcit() # command line calculator
########
{
# if no argument provided (we expect at least one)
if [ x$1 = "x" ] ; then
echo Examples: calcit -s 2 \"13000 / 530000\"
echo " the -s 2 means set the scale to 2 decimal places"
echo or
echo calcit \"13000 / 530000\"
fi
# if the first argument is "-s" then grab the next arg as the desired scale
# i.e.: places past the decimal point
if [ "x$1" = "x-s" ]; then
SCALE=$2
shift 2
fi
SCALE=${SCALE:-1}
# now pump in the scale and the rest of the argument(s) (which we assume the is the calculation)
# into bc (-q for quiet [no welcome banner] and -l for math libraries)
bc -ql <
I can easily run a quick calculation from the command line with something like this:
apt-get install subversion subversion-tools apache2 libapache2-svn
# Create a new repository
mkdir /data/svnrepos
svnadmin create /data/svnrepos
grpadd svn
#(add the desired users to this group
# - remember they need to restart - even X
# - then
chmod -R g+rw /data/svnrepos
chgrp -R svn /data/svnrepos
# the repository is now ready
#### to import a project
cd to your dev dir eg
cd $HOME/dev
#then
mkdir myproj
cd myproj
mkdir trunk branches tags # trust me add all 3 of these
#edit some files in the trunk dir
cd trunk # $HOME/dev/myproj/trunk
cat "lots of stuff">new.fil
Continue reading →
I had an interesting issue develop today. I was asked to help with a Solaris 10 system that failed to come up after a reboot, or rather, was unreachable remotely after a reboot. The kernel answered to a ping but ssh failed to respond. Fortunately I was able to string a console cable to a laptop and took a look at what was going on. Listing the services and grepping for ssh
# svcs | grep ssh
showed ssh failed to come online. I tried to restart it without success but no messages about why.
# svcadm restart ssh
Doing an check of dependencies
# svcs -d ssh
and a detailed check on the service
# svcs -xv ssh
showed that the filesystem/local:default service was failing to come up. Hmmmm, doing a df -k seemed ok….