Convert bash script from unix to linux


i found this script that should monitor tsm server , if i run this script the result don't show  as it should be
all can i see is gibberish
i want to run this script in Linux environment  ( red hat )
This is a ksh script running on AIX and i need help to convert it  Linux

here is the link to the script -

i attach this script to this message


Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You must be getting the commands run and error messages.

You can look at each error and try to fix it.

Can you share the output you get when you run the script?
TSMILAuthor Commented:

i attach the outpit file that i got

the problem is that - Depending on the status of the result, you 'll have different colors green (OK), orange (WARNING), red (CRITICAL)

what i see in the html file is just numbers and word and accroding to the script is to see it in grafical wasy


What I meant is if you run the script from command line like:

/bin/ksh93 -x /path/to/script > /tmp/myscriptlog 2>&1 (please put your own path and scriptname)

Then you can look at the log file /tmp/myscriptlog and see the commands failing and try fix them.
The 7 Worst Nightmares of a Sysadmin

Fear not! To defend your business’ IT systems we’re going to shine a light on the seven most sinister terrors that haunt sysadmins. That way you can be sure there’s nothing in your stack waiting to go bump in the night.

TSMILAuthor Commented:

i attach the log file and the html file , i don't see any error but still the display of html file is incorrect

is there any thing that i can do to display the html file correctly
The extra spaces may be due to the
 sed 's/\|/\ /g'
In some versions of sed, you'd want to omit the \, but I'm not sure what syntax your sed is using, so I'll suggest changing it to
 tr '|' ' '

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Did changing the sed command help?
TSMILAuthor Commented:

im sorry about the delay

i check it now and it didn't help - the problem is convert to html

the display is wrong

TSMILAuthor Commented:
hi again

i check this script on UNIX and its work like charm

the problem is only on Linux system ( red hat )
How did you change the sed command and what  was the html result on Linux system?
TSMILAuthor Commented:
the result was the same before the change
when i run this on UNIX its work

i attach 2 print screen

you can see the difference between the 2
How did you change the sed command?
TSMILAuthor Commented:
 sorry for long long long delay
i replace with  tr '|' ' ' and now the display is O.K
but in TSM  error  section it look like this - i attach file called TSM_error.PNG
how can i fix it please ???

and also attach the script called TSM-SCRIPT.txt
the os is redhat 6.5

Murugesan NagarajanShell_script Automation /bin/bash /bin/bash.exe /bin/ksh /bin/mksh.exe AIX C C++ CYGWIN_NT HP-UX Linux MINGW32 MINGW64 SunOS Windows_NTCommented:
Accept related answer or delete the query since last comment posted on 2015-06-29
else, forced accept after 14 days of inactivity.
Murugesan NagarajanShell_script Automation /bin/bash /bin/bash.exe /bin/ksh /bin/mksh.exe AIX C C++ CYGWIN_NT HP-UX Linux MINGW32 MINGW64 SunOS Windows_NTCommented:
>>  sorry for long long long delay
>> i replace with  tr '|' ' ' and now the display is O.K
1. Provided related comments
2. Tested and resolved
3. Inactive for more days.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.