I have an alias that passes in some parameters to a tool that I use often.  Sometimes I run as myself, sometimes under sudo.  Unfortunately, of course, sudo doesn't recognise the alias.

Does anyone have a hint on how to pass the alias through?

In this case, I have a bunch of options for perl when I'm debugging:

alias pd='perl -Ilib -I/home/myuser/lib -d'


Sometimes, I have to debug my tools as root, so, instead of running:

pd ./mytool --some params


I need to run it under sudo.  I've tried many ways:

sudo eval $(alias pd)\; pd ./mytool --some params
sudo $(alias pd)\; pd ./mytool --some params
sudo bash -c "$(alias pd)\; pd ./mytool --some params"
sudo bash -c "$(alias pd); pd ./mytool --some params"
sudo bash -c eval\ "$(alias pd)\; pd ./mytool --some params"
sudo bash -c eval\ "'$(alias pd)\; pd ./mytool --some params'"


I was hoping for a nice, concise way to ensure that my current pd alias was fully used (in case I need to tweak it later), though some of my attempts weren't concise at all.  My last resort is to put it into a shell script and put that somewhere that sudo will be able to find.  But aliases are soooo handy sometimes, so it is a last resort.


Question: What is the best introductory Bayesian statistics textbook?
Answer: Not strictly Bayesian Statistics as such, but I can strongly recommend "A First Course on Machine Learning" by Rogers and Girolami, which is essentially an introduction to Bayesian approaches to machine learning.  Its very well structured and clear and aimed at students without a strong mathematical background.  This means it is a pretty good first introduction to Bayesian ideas.  There is also MATLAB/OCTAVE code which is a nice feature.