Friday, November 13, 2009

Shell Standard I/O

Q: What is the difference between these two shell statements?

$cmd >> $logFile 2>&1
And
$cmd 2>&1 >> $logFile

Answer:
The first one is right and second one is wrong.

first one redirects any output from the $cmd to the $logFile. The second one just redirects the output and not the STDERR to the $logFile.

Reference:
http://www.linux-mag.com/id/5103

Sunday, November 01, 2009

Moral Dilemma

Q: How to decide if an action is morally right or wrong? E.g.
1. Taking a personal prinout using office printer?
2. Making a phone call using office phone ?
3. Stealing salad from the salad bar at office canteen?
4. Keeping the IPOD nano 4 GB found on a street at halloween pary on franklin street with urself?

Ans: If you can tell all your friends and family members about the action then the action should be morally right.
1. Should be OK.
2. Should be OK.
3. WRONG.
4. Dicey.