Wednesday, December 28, 2011

My favorite bach command prompt PS1

cd ~
nano .profile
add following line at the end
PS1="[\u@\h \W]$ "
export PS1

logout/login

easy to read link for more.

Friday, December 23, 2011

GoldenDict is not starting due to "Another GoldenDict copy started already."

smth happen...
Golden dict could not be started. Launch from menu will not open anything.
Launch from terminal:
rivanov@rivanov-desktop:~$ goldendict
Another GoldenDict copy started already.

There is no goldendict process.

Solution:
rm -f ~/.goldendict/pid

Monday, December 12, 2011

Convert file to remove End Of Line character windows/dos to unix/linux

http://www.virtualhelp.me/linux/164-dos2unix-missing-ubuntu-1004

Summary:
sudo aptitude install tofrodos
sudo ln -s fromdos dos2unix
sudo ln -s todos unix2dos

Usage:
dos2unix 1.txt

Wednesday, December 7, 2011

Show only dates in chronology of CVS changes

Command line:
cvs log | grep date: | sort -t ' ' -k2

Sunday, December 4, 2011

Bash/Shell if conditions are lazy for '&&'(AND) expressions


This script is showing that &&(AND) conditions are optimized in Bash/Shell to not calculate rest of condition if first part is already FALSE.

#!/bin/bash

IS_HOLIDAY='N'
RUN_DAYOFF='N'
#if  [ "x$IS_HOLIDAY" = "xY" ]  && [ "x$RUN_DAYOFF" != "xY" ]; then
if  [ "x$IS_HOLIDAY" = "xY" ]  && [ echo 'sdfs' ]; then
    echo "Skipping unit , today is dayoff"
else
      echo "DO unit , today is dayoff"
fi
echo "finished."