I have a slightly old Ubuntu based distro with a slightly new wifi card that has never had a working wifi driver so I've been having to bake my own. Of course every time a new kernel comes out I have to recompile it with my own wifi driver.
When, say, I'm on a moving train and I update my system, which in turn updates the kernel which then kills my wifi, which then requires me to download the latest headers to re-compile the wifi driver into the kernel, it feels a lot like my own personal hell. I've learned to deal with it by adopting the mantra "dealing with Linux drivers is like going to war armed with a teaspoon".
To save me a lot of pain, I have a BASH script that compiles the driver into the kernel and starts it etc. I also have a custom alias that updates my system, it runs apt-get update, apt-get dselect-upgrade etc, and the second last and important thing it does is download the current kernel headers. I do it with this:
apt-get install linux-headers-`uname -r`
Running this command in a console does the job fine. But within my alias, it seems to grep a whole lot of crap back into it somehow, and I get what feels like a thousand different messages like:
Note, selecting 'libcpan-uploader-perl' for regex 'tree...'
I'd love to know why this happens, I'd probably be able to stop it if I knew why. I'm sure it has something to do with running a sub-command from within an alias. If you know BASH well and can explain this to me I'd greatly appreciate it. I expect most Linux users will ask why the f**k I use BASH and Windows users will ask what the f**k is BASH.
Here are the relevant parts of my ~/.bashrc :
alias nomnomnom='echo Updating repository...
sudo apt-get -yu update
sudo apt-get -yfu dselect-upgrade
echo Updating kernel headers...
sudo apt-get install linux-headers-`uname -r`
echo Cleaning up...
sudo apt-get -yu autoclean
sudo apt-get -yu autoremove
alias fixwifi='echo Shutting down WiFi...
sudo ifconfig wlan0 down
sudo make install
echo Restarting WiFi...
sudo modprobe rtl8723e
sudo modprobe -r rtl8723e
sudo modprobe rtl8723e ips=0
sudo ifconfig wlan0 up
sudo ifconfig wlan0
I've come to the conclusion that backticks in an alias are just plain buggy in BASH so I've moved the alias to /blah/bin/nomnomnom and it just works now.