Click here to Skip to main content
15,611,156 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I have a script writeen in ksh(Unix) and need to port to bash(Linux).
I am stuck at a point to know whether the arguments passing format differ in both:
well, how the script is written is :
echo "$1\n$2\n$3\n" | /path/to/binary/of/script >/dev/null 2>/dev/null(from the main script it is calling another script to run basically)

And how I know is

"sh /path/to/script $1 $2 $3"

To understand pitfalls, I copied the script to Linux and ran. The script fails and throws error. And I doubt is it due to the format

Any help is appreciated!

What I have tried:

The access to edit script is not with me as of now to change and check. Bad luck
Updated 3-Jun-19 4:19am
Richard MacCutchan 3-Jun-19 4:29am    
What is the error?

A script saved to a file to execute in Linux should begin:

Then the next line(s) of the script should be the command line(s) to execute:
echo "$1\n$2\n$3\n" | /path/to/binary/of/script &> /dev/null

That's a text file of two or more lines. The &> redirects standard out and standard error.
Will it work to call the binary directly? Have you tried:
user@host$ /path/to/binary/of/script arg1 arg2 arg3 &> /dev/null

Share this answer
If you're more comfortable with ksh, why not just install it on your linux distro? It should be available for most distros. If not see KornShell[^]
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900