ksh script migration from Solaris to Linux.

We are migrating some scripts (ksh) from Solaris 10 to Linux 2.6.32.

Can someone share list of changes i need to take care for this ?

Have found few of them but i am looking for a exhaustive list.

Thanks.

Scripts should run in linux as well because ksh also there, you just need to modify the paths or other variable.

No it doesnt , one of the example :


Linux :
$echo "\nabc"
\nabc

Solaris:
$echo "\nabc

abc

For that you can use


echo -e "\nabc"

The problem is that the functionality of echo is a mess among different shells and versions, and there doesn't seem to be any defined standard on its behavior.

The above example is most likely caused because you are using ksh88 in Solaris, and ksh93 in Linux.

So, in this case you shouldn't really be using echo but printf to avoid dealing with these problems.

From ksh93 man page:

I just gave an example that needs an change when migrating to Linux.
I am basically needing an "exhaustive list" with changes like these documented.

Can anyone help ?

There is an unapproved draft technical report titled Conflicts between ISO/IEC 9945 (POSIX) and the Linux Standard Base that may help. No Linux implementation I've ever heard of conformed to the LSB and (unless you have /usr/xpg4/bin before /usr/bin in your setting of $PATH) many of the utilities in your search path might not conform to POSIX requirements on your Solaris system. And, Linux systems, Solaris systems, and the standards have all changed since this October 2004 report. But, despite all of these caveats, it may give you some helpful hints on possible porting problems.

PS The standards do explicitly define the behavior of the echo utility. Unfortunately, the standards allow either UNIX System V echo behavior or BSD echo behavior and GNU echo ignores the standards and does not match either UNIX System V or BSD echo behavior. As verdepollo suggested, use printf instead of echo if the first argument to echo could start with a minus sign or if any argument to echo could contain a backslash character.