Pages

Wednesday, March 13, 2013

bash loop interval

For loop in bash using an interval is fairly simple:
    for i in {1..3}; do echo "r${i}r";done
It becomes a bit more complicated if you want to use a parametric value for the end of the interval:
    n=5
    for i in $(seq 1 $n);do echo "r${i}r";done

Tuesday, March 12, 2013

setting LANG environment variable

Setting LANG environment variable in linux sounds as an easy task:
    export LANG=en_US.utf8
But when attempting to make this change permanent, it is no longer an easy task. Exporting this in /etc/profile, ~/.bashrc or ~/.bash_profile does not have the desired effect. 
After doing a fair amount of googling I found out the solution for this: create a file called ~/.i18n which contains you LANG setting:
    cat ~/.i18n
   LANG=en_US.utf8
This does the trick.