Monday 30 November 2009

Unix Shell Differences

To check the differences between various types of shells of Unix, I searched on net and found something good. This doesn’t give everything in detail but gives some picture. History given here is good.

http://www.faqs.org/faqs/unix-faq/shell/shell-differences/

The list of shells that are developed till now are -
bourne shell – sh – input language: bourne shell language
c shell – csh - input language: c language
T shell – tcsh - input language: c language – enhanced c shell
Korn shell – by At&T – ksh – POSIX compatible - input language: bourne shell language
Bourne Again shell – by GNU – bash – POSIX compatible – input language: bourne shell language
Ksh and bash are almost similar – but the first is not free and later is free.
RC – it got enhanced later to es.
Zsh – the recent shell

(Next time something in detail about every shell)

We can also find some of the shells in detail over here on the same site. Also I got some harry potter sites. ;)

Also, the file name completion, command completion; it is called TENEX style completion. I didn’t know this.

Monday 23 November 2009

varargs

- This is about varargs in Java. They are called Variadic arguments.And the function having such arguments is called Variadic Function.
- They are to be used when you need to use unknown number of arguments of same type.
e.g. log function where you need to print a string which can be formed of any number of string objects.
- This argument must be the last parameter of a method.

For examples -
click

This works nice in case of polymorphism.


public class Test
{
public static void fun(Parent... args){
for (Parent i : args){
i.setA(5);
System.out.println("a is " + i.getA());
}
}


public static void main(String args[])
{
Parent p = new Parent();
ChildA a = new ChildA();
ChildB b = new ChildB();
fun(p,a,b);
}
}