Table of Contents

Name

shells - a quick reminder to some shell languages

Description

Whether you write in sh, csh, perl or any language, sometimes switching between them causes the personal memory to leak. Here is a simple table that side-by-side compares different common shells.

Shell


sh                          csh                         perl
-------------------------   -------------------------   -------------------------
a="Hi world"                set a="Hi world"            $a="Hi World";
echo $a                     echo $a                     print a,"0;
if [ $a = "yes" ];then      if ($a == "yes") then       if ( a eq "yes"
) {
else if [ ... ]; then       else if ( ... ) then        } elsif {  # notice spelling
else                        else                        } else {
fi                          endif                       }

read a                      set a=$<                    chomp ( $a = <> );

while                       while ($n > 0)              while ( $a > 0 )
{
end?                        end                         }

                                                        for ( $n = 99;
$n > 0; $n-- ) { 
                                                        }

                            foreach n (1 2 3)           foreach $n ( 1..3
) {
                            end                         }

                            set a=(1 2 3)               @a=("a", "b", "c");

                            Int  Str                         Num     Str
                            ==   ==                     ==      eq
                            !=   !=                     !=      ne
                            <                           <       lt
                            >                           >       gt
                            <=                          <=      le
                            >=                          >=      ge

See Also

functions(5NEMO)
http://merd.sourceforge.net/pixel/language-study/syntax-across-languages.html
http://merd.sourceforge.net/pixel/language-study/scripting-language/

Author

Peter Teuben

Update History


7-apr-01   document created     PJT


Table of Contents