Migrating shell scripts from Solaris 10 to RHEL 7.5 [on hold]
up vote
-2
down vote
favorite
Source environment:
$ uname -a
SunOS machine1 5.10 Generic_150400-63 sun4u sparc SUNW,SPARC-Enterprise
$ pwd
/
$ ls -l /bin/sh
lrwxrwxrwx 1 root root 13 Nov 1 19:39 /bin/sh -> ../../sbin/sh
Target environment:
$ pwd
/root
$ ls -l /bin/sh
lrwxrwxrwx. 1 root root 4 Jul 16 12:10 /bin/sh -> bash
$ cat /etc/system-release
Red Hat Enterprise Linux Server release 7.5 (Maipo)
In target environment, we use shebang line #!/bin/sh
in every script
Shell scripts in solaris environment are using shebang line #!/usr/bin/ksh
and #!/bin/sh
Goal is to migrate shell scripts from Solaris 10 to RHEL 7.5
1) Are scripts written solaris korn shell & /bin/sh
shell, posix compliant? for seamless migration to bash(in Linux) without verification of code..
2) If no, What are the verifications required before migrating scripts to Linux?
linux shell-script shell posix
put on hold as too broad by Ipor Sircer, Jeff Schaller, RalfFriedl, Romeo Ninov, Archemar 2 days ago
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
up vote
-2
down vote
favorite
Source environment:
$ uname -a
SunOS machine1 5.10 Generic_150400-63 sun4u sparc SUNW,SPARC-Enterprise
$ pwd
/
$ ls -l /bin/sh
lrwxrwxrwx 1 root root 13 Nov 1 19:39 /bin/sh -> ../../sbin/sh
Target environment:
$ pwd
/root
$ ls -l /bin/sh
lrwxrwxrwx. 1 root root 4 Jul 16 12:10 /bin/sh -> bash
$ cat /etc/system-release
Red Hat Enterprise Linux Server release 7.5 (Maipo)
In target environment, we use shebang line #!/bin/sh
in every script
Shell scripts in solaris environment are using shebang line #!/usr/bin/ksh
and #!/bin/sh
Goal is to migrate shell scripts from Solaris 10 to RHEL 7.5
1) Are scripts written solaris korn shell & /bin/sh
shell, posix compliant? for seamless migration to bash(in Linux) without verification of code..
2) If no, What are the verifications required before migrating scripts to Linux?
linux shell-script shell posix
put on hold as too broad by Ipor Sircer, Jeff Schaller, RalfFriedl, Romeo Ninov, Archemar 2 days ago
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
very basic script might run smoothly, however command likedevfsadm
orluxadm
have no equivalent in redhat.
– Archemar
2 days ago
add a comment |
up vote
-2
down vote
favorite
up vote
-2
down vote
favorite
Source environment:
$ uname -a
SunOS machine1 5.10 Generic_150400-63 sun4u sparc SUNW,SPARC-Enterprise
$ pwd
/
$ ls -l /bin/sh
lrwxrwxrwx 1 root root 13 Nov 1 19:39 /bin/sh -> ../../sbin/sh
Target environment:
$ pwd
/root
$ ls -l /bin/sh
lrwxrwxrwx. 1 root root 4 Jul 16 12:10 /bin/sh -> bash
$ cat /etc/system-release
Red Hat Enterprise Linux Server release 7.5 (Maipo)
In target environment, we use shebang line #!/bin/sh
in every script
Shell scripts in solaris environment are using shebang line #!/usr/bin/ksh
and #!/bin/sh
Goal is to migrate shell scripts from Solaris 10 to RHEL 7.5
1) Are scripts written solaris korn shell & /bin/sh
shell, posix compliant? for seamless migration to bash(in Linux) without verification of code..
2) If no, What are the verifications required before migrating scripts to Linux?
linux shell-script shell posix
Source environment:
$ uname -a
SunOS machine1 5.10 Generic_150400-63 sun4u sparc SUNW,SPARC-Enterprise
$ pwd
/
$ ls -l /bin/sh
lrwxrwxrwx 1 root root 13 Nov 1 19:39 /bin/sh -> ../../sbin/sh
Target environment:
$ pwd
/root
$ ls -l /bin/sh
lrwxrwxrwx. 1 root root 4 Jul 16 12:10 /bin/sh -> bash
$ cat /etc/system-release
Red Hat Enterprise Linux Server release 7.5 (Maipo)
In target environment, we use shebang line #!/bin/sh
in every script
Shell scripts in solaris environment are using shebang line #!/usr/bin/ksh
and #!/bin/sh
Goal is to migrate shell scripts from Solaris 10 to RHEL 7.5
1) Are scripts written solaris korn shell & /bin/sh
shell, posix compliant? for seamless migration to bash(in Linux) without verification of code..
2) If no, What are the verifications required before migrating scripts to Linux?
linux shell-script shell posix
linux shell-script shell posix
edited 2 days ago
Jeff Schaller
35.8k952119
35.8k952119
asked 2 days ago
overexchange
352214
352214
put on hold as too broad by Ipor Sircer, Jeff Schaller, RalfFriedl, Romeo Ninov, Archemar 2 days ago
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
put on hold as too broad by Ipor Sircer, Jeff Schaller, RalfFriedl, Romeo Ninov, Archemar 2 days ago
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
very basic script might run smoothly, however command likedevfsadm
orluxadm
have no equivalent in redhat.
– Archemar
2 days ago
add a comment |
very basic script might run smoothly, however command likedevfsadm
orluxadm
have no equivalent in redhat.
– Archemar
2 days ago
very basic script might run smoothly, however command like
devfsadm
or luxadm
have no equivalent in redhat.– Archemar
2 days ago
very basic script might run smoothly, however command like
devfsadm
or luxadm
have no equivalent in redhat.– Archemar
2 days ago
add a comment |
1 Answer
1
active
oldest
votes
up vote
4
down vote
You may not migrate the code without looking at it. You need to test run the scripts in a safe environment and compare the results with the expected result for the same test on Solaris. You should also investigate if the fail conditions are the same on both system (missing files, invalid data, etc.).
It doesn't matter how POSIX the shells are that the scripts have been written for, as the scripts may well call non-POSIX or Solaris-specific utilities or use non-POSIX shell extensions. They may also make assumptions about the environment (where files are located, what devices and interfaces are called etc.) that needs to be updated for Linux.
The ksh
shell on Solaris is quite different from bash
on Linux, so you simply can't expect the ksh
scripts to "just run" in sh
or bash
on Linux.
Would shellcheck.net give a good start?
– overexchange
yesterday
Checking line by line is not a wise idea...
– overexchange
yesterday
1
@overexchange ShellCheck will only ever tell you whether the syntax of the script is ok. It is unable to tell you whether the script does what you think it does or whether it would run ok on Linux.
– Kusalananda
yesterday
1
@overexchange If I was given a randomksh
script from a Solaris machine and was told I had to make it run on Linux under/bin/sh
, I would definitely go through it line by line until I understood it and could see that it would be doing the right thing on Linux too.
– Kusalananda
yesterday
We also have scripts using /bin/sh in Solaris.... as mentioned in query. Do I need to approach similar way like ksh scripts?
– overexchange
yesterday
|
show 1 more comment
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
You may not migrate the code without looking at it. You need to test run the scripts in a safe environment and compare the results with the expected result for the same test on Solaris. You should also investigate if the fail conditions are the same on both system (missing files, invalid data, etc.).
It doesn't matter how POSIX the shells are that the scripts have been written for, as the scripts may well call non-POSIX or Solaris-specific utilities or use non-POSIX shell extensions. They may also make assumptions about the environment (where files are located, what devices and interfaces are called etc.) that needs to be updated for Linux.
The ksh
shell on Solaris is quite different from bash
on Linux, so you simply can't expect the ksh
scripts to "just run" in sh
or bash
on Linux.
Would shellcheck.net give a good start?
– overexchange
yesterday
Checking line by line is not a wise idea...
– overexchange
yesterday
1
@overexchange ShellCheck will only ever tell you whether the syntax of the script is ok. It is unable to tell you whether the script does what you think it does or whether it would run ok on Linux.
– Kusalananda
yesterday
1
@overexchange If I was given a randomksh
script from a Solaris machine and was told I had to make it run on Linux under/bin/sh
, I would definitely go through it line by line until I understood it and could see that it would be doing the right thing on Linux too.
– Kusalananda
yesterday
We also have scripts using /bin/sh in Solaris.... as mentioned in query. Do I need to approach similar way like ksh scripts?
– overexchange
yesterday
|
show 1 more comment
up vote
4
down vote
You may not migrate the code without looking at it. You need to test run the scripts in a safe environment and compare the results with the expected result for the same test on Solaris. You should also investigate if the fail conditions are the same on both system (missing files, invalid data, etc.).
It doesn't matter how POSIX the shells are that the scripts have been written for, as the scripts may well call non-POSIX or Solaris-specific utilities or use non-POSIX shell extensions. They may also make assumptions about the environment (where files are located, what devices and interfaces are called etc.) that needs to be updated for Linux.
The ksh
shell on Solaris is quite different from bash
on Linux, so you simply can't expect the ksh
scripts to "just run" in sh
or bash
on Linux.
Would shellcheck.net give a good start?
– overexchange
yesterday
Checking line by line is not a wise idea...
– overexchange
yesterday
1
@overexchange ShellCheck will only ever tell you whether the syntax of the script is ok. It is unable to tell you whether the script does what you think it does or whether it would run ok on Linux.
– Kusalananda
yesterday
1
@overexchange If I was given a randomksh
script from a Solaris machine and was told I had to make it run on Linux under/bin/sh
, I would definitely go through it line by line until I understood it and could see that it would be doing the right thing on Linux too.
– Kusalananda
yesterday
We also have scripts using /bin/sh in Solaris.... as mentioned in query. Do I need to approach similar way like ksh scripts?
– overexchange
yesterday
|
show 1 more comment
up vote
4
down vote
up vote
4
down vote
You may not migrate the code without looking at it. You need to test run the scripts in a safe environment and compare the results with the expected result for the same test on Solaris. You should also investigate if the fail conditions are the same on both system (missing files, invalid data, etc.).
It doesn't matter how POSIX the shells are that the scripts have been written for, as the scripts may well call non-POSIX or Solaris-specific utilities or use non-POSIX shell extensions. They may also make assumptions about the environment (where files are located, what devices and interfaces are called etc.) that needs to be updated for Linux.
The ksh
shell on Solaris is quite different from bash
on Linux, so you simply can't expect the ksh
scripts to "just run" in sh
or bash
on Linux.
You may not migrate the code without looking at it. You need to test run the scripts in a safe environment and compare the results with the expected result for the same test on Solaris. You should also investigate if the fail conditions are the same on both system (missing files, invalid data, etc.).
It doesn't matter how POSIX the shells are that the scripts have been written for, as the scripts may well call non-POSIX or Solaris-specific utilities or use non-POSIX shell extensions. They may also make assumptions about the environment (where files are located, what devices and interfaces are called etc.) that needs to be updated for Linux.
The ksh
shell on Solaris is quite different from bash
on Linux, so you simply can't expect the ksh
scripts to "just run" in sh
or bash
on Linux.
edited 2 days ago
answered 2 days ago
Kusalananda
115k15218351
115k15218351
Would shellcheck.net give a good start?
– overexchange
yesterday
Checking line by line is not a wise idea...
– overexchange
yesterday
1
@overexchange ShellCheck will only ever tell you whether the syntax of the script is ok. It is unable to tell you whether the script does what you think it does or whether it would run ok on Linux.
– Kusalananda
yesterday
1
@overexchange If I was given a randomksh
script from a Solaris machine and was told I had to make it run on Linux under/bin/sh
, I would definitely go through it line by line until I understood it and could see that it would be doing the right thing on Linux too.
– Kusalananda
yesterday
We also have scripts using /bin/sh in Solaris.... as mentioned in query. Do I need to approach similar way like ksh scripts?
– overexchange
yesterday
|
show 1 more comment
Would shellcheck.net give a good start?
– overexchange
yesterday
Checking line by line is not a wise idea...
– overexchange
yesterday
1
@overexchange ShellCheck will only ever tell you whether the syntax of the script is ok. It is unable to tell you whether the script does what you think it does or whether it would run ok on Linux.
– Kusalananda
yesterday
1
@overexchange If I was given a randomksh
script from a Solaris machine and was told I had to make it run on Linux under/bin/sh
, I would definitely go through it line by line until I understood it and could see that it would be doing the right thing on Linux too.
– Kusalananda
yesterday
We also have scripts using /bin/sh in Solaris.... as mentioned in query. Do I need to approach similar way like ksh scripts?
– overexchange
yesterday
Would shellcheck.net give a good start?
– overexchange
yesterday
Would shellcheck.net give a good start?
– overexchange
yesterday
Checking line by line is not a wise idea...
– overexchange
yesterday
Checking line by line is not a wise idea...
– overexchange
yesterday
1
1
@overexchange ShellCheck will only ever tell you whether the syntax of the script is ok. It is unable to tell you whether the script does what you think it does or whether it would run ok on Linux.
– Kusalananda
yesterday
@overexchange ShellCheck will only ever tell you whether the syntax of the script is ok. It is unable to tell you whether the script does what you think it does or whether it would run ok on Linux.
– Kusalananda
yesterday
1
1
@overexchange If I was given a random
ksh
script from a Solaris machine and was told I had to make it run on Linux under /bin/sh
, I would definitely go through it line by line until I understood it and could see that it would be doing the right thing on Linux too.– Kusalananda
yesterday
@overexchange If I was given a random
ksh
script from a Solaris machine and was told I had to make it run on Linux under /bin/sh
, I would definitely go through it line by line until I understood it and could see that it would be doing the right thing on Linux too.– Kusalananda
yesterday
We also have scripts using /bin/sh in Solaris.... as mentioned in query. Do I need to approach similar way like ksh scripts?
– overexchange
yesterday
We also have scripts using /bin/sh in Solaris.... as mentioned in query. Do I need to approach similar way like ksh scripts?
– overexchange
yesterday
|
show 1 more comment
very basic script might run smoothly, however command like
devfsadm
orluxadm
have no equivalent in redhat.– Archemar
2 days ago