Stand With Ukraine

Tuesday, June 29, 2010

Mac Ports automation bash script

Mac ports is a very useful system for installing linux applications ported to MacOS (http://www.macports.org), it is easy to use and I am happy with it till now. But it does not delete the old versions of software after update, or I just did not find a proper command for this. So I wrote this bash script to automate the task and successfully used it.
Here is its output during the execution:
radar2:tmp huziy$ ./port_cleaner.sh 
33
Password:
--->  Uninstalling hdf5-18 @1.8.4-patch1_1
--->  Uninstalling hdfeos5 @1.12_0
--->  Uninstalling ImageMagick @6.6.2-0_0+q16
--->  Uninstalling iso-codes @3.16_0
--->  Uninstalling libtool @2.2.6b_1+darwin
--->  Uninstalling mc @4.7.0.2_0+slang2
--->  Uninstalling mpfr @2.4.2-p1_0
--->  Uninstalling mpfr @3.0.0_0
--->  Uninstalling openmotif @2.3.2_2
--->  Uninstalling openssl @0.9.8n_0+darwin
--->  Uninstalling python26 @2.6.5_1
--->  Uninstalling xorg-libX11 @1.3.3_0
--->  Uninstalling xorg-libXcomposite @0.4.1_0
--->  Uninstalling xorg-libXdamage @1.1.2_0
--->  Uninstalling xorg-libXext @1.1.1_0
--->  Uninstalling xorg-libXfixes @4.0.4_0
--->  Uninstalling xorg-util-macros @1.8.0_0



And finally the script itself:



I used this tutorial http://tldp.org/LDP/abs/html/arrays.html to write the script.