Not getting expected output

Hi

I have written below script to get the data in table form.

#!/bin/sh
echo "File Name\tType"
for i in *;
do
echo "$i\t\c"
if [ -d $i ]; then
echo "directory"
elif [ -h $i ]; then
echo "symbolic link"
elif [ -f $i ]; then
echo "file"
else
echo "unknown"
fi
done

however i am getting output in different way . pls see below

sel1 \t\c
file
t1 \t\c
file
t1.txt \t\c
file
test \t\c
file
test1 \t\c
file
true.tar \t\c
file
vk \t\c
directory

i also noticed that the command

echo "File Name\tType"

is not working properly in script but when i run this separately it is working fine .

$ echo "File Name\tType"
File Name       Type
$ 

i am using ksh shell

regards,
Scriptor

try with -e

echo -e "$i\t\c"

Yuk!

Use printf instead.

thx itkamaraj this helps

but why the same command behave differently ?
regards,
Scriptor