@overexchange Depending on whether con_command is a script or a function, the FPATH variable may also come into play. You really need to read and understand the script you are porting from Solaris to Linux, especially if you are porting it to a new shell.
I understand the basic difference between an interactive shell and a non-interactive shell. But what exactly differentiates a login shell from a non-login shell?
Can you give examples for uses of a non-login interactive shell?
we actually do sudo su - username and then start application
so this is login shell
@Kusalananda So... basically 1) I have ksh88 running scripts in solaris 10 with shebang line #!/usr/bin/ksh 2) /bin/sh -> /sbin/sh Bourneshell running scripts in solaris 10 with shebang line #!/bin/sh
I need to port these two categories of scripts to Linux box that has ksh93 and /bin/sh -> bash
Looks like there is no bourne shell in RHELinux box
Porting is difficult. I can't say "do this and it will work". You will have to read and understand the scripts, and then reimplement the things that work differently between the two systems. There are no shortcuts.
I can't emphasise this enough, you absolutely have to look at every single line of the scripts that you port to make sure that you understand what it is doing on Solaris and what it would do on Linux running under a different shell.
You have to understand how sh and ksh works on Solaris and you have to understand how sh works on your Linux system.
Shell is an interface between a user and OS to access to an operating system's services. It can be either GUI or CLI (Command Line interface).
sh (Bourne shell) is a shell command-line interpreter, for Unix/Unix-like operating systems. It provides some built-in commands. In scripting language we...
@overexchange sh on your Linux is bash running in POSIX compatibility mode, i.e. as if bash --posix was used. You should really be looking at the bash manual.
@terdon You also have to take the Solaris environment into account, and how it differs from Linux. You simply can't say "this script will work on Linux, because it uses sh".
If he's porting an application (that is evidently running as root), and he's doing it as part of his job, then assuming that the scripts will work because they use the same shell variant is both negligent and dangerous.
Urgh yes, in a previous life I had to write shell scripts which would work on ksh88 on Solaris, ksh93 (IIRC) on AIX, and bash on Linux. There are significant, non-shell-related differences between all three. The answer really depends on what the shell script is supposed to do...
@Kusalananda No, I just mean the script will run and the syntax won't need to be changed. Now, whether or not the scripts will do what they are supposed to is another matter.
@StephenKitt Thanks. (1) In C, when does execution of function definitions happen?
(2) In all these languages, what is "execution of function definitions"? What result is "execution of function definitions " expected to generate? In all these languages, is "execution of function definitions " expected to create a "link" between the function names and their implementations, so that when executing a function call the interpreter can find the function implementation? Is this linking in C, interpretation in Bash, and compilation in awk?
@Kusalananda having.... shell variants + OS variants ...... as an adding factor for complexity... When you say... porting is difficult... Can I take it as.... syntax and semantic errors MAY BE uncovered during execution time but not parsing time?
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,...
@overexchange It's more likely that you will run into application issues and/or will be attempting to use files/directories that don't exist on one system but do on the other
It doesn't matter if all of your variable expansions are error-free if the underlying commands to gather that information (or pass it along) are different.
@Kusalananda For sure.... am not shy to visit each and every line....but trying to grab the complexities in porting exercise before I start doing it....
I did port C code from 32 bit OS to 64 bit OS.. but I did not expect the same initially.....
In case of shell script
As Stephen says.... the answer really depends on what the shell script is supposed to do...
@JeffSchaller we did not visit each line of C code instead we relied on level 1, level 2, level 3 warnings from C compiler...
It was 200 MB odd Source code
So... I was looking for such approach for porting shell scripts...
But... shell script environment is like interpreter based environment similar to python
@JeffSchaller So... I think... I changed my mind because.... as I already said... syntax and semantic errors will be uncovered in execution time but not parse time...
You're coming across very poorly. You are asking for help and then essentially telling everyone they are wrong. Your over/misuse of ellipsis don't help. So yes I am happy using these comments.
"I need help with this problem but I already know everything..."
The latest comment is just telling you what everyone else has been telling you for the past few hours: you need to check this manually and cannot just copy the scripts over and expect they will work even if the shell is the same.
@overexchange One suggestion, since you mentioned that you haven't really started on this porting project yet, would be to start doing it. Then, if anything turns up that you really can't resolve on your own or with the help of colleagues or the Internet, you could formulate it as a question for this site. At the moment it sounds like you are actively looking for things that may be difficult or that you may have issues with.
The complexities of porting a set of scripts can be huge, but it could also be trivial. You haven't started yet so there's no way of knowing.
@overexchange You see, I'm on one hand saying that you need to be careful (see many previous comments), but on the other hand I'm saying that you can't really know what to be careful about until you've started. In any case, you have to do test runs and code reading.
@Jesse_b The problem is that he is consistently not asking for "help". He is asking that people thinks for him without trying and people validate actions....complicated.
Yeah, I feel like he's just trying to find an easy way out which I cannot blame him for. I always try to find the easiest way to accomplish a task, but in this case there isn't really an easy way.
@Jesse_b Nah, he is just constantly asking for cut and dried recipes when the questions involve some thinking...and then posts things in the group and often is so eager to mik and the possible answers from someone that gives some time to him that he does not realize he can be tiring. I think...
Yeah, my grandfather had dementia towards the end of his life, but not terribly bad. He would usually remember things but about 30% of the time he either didn't know who he was or thought he was at earlier periods of his life
@FaheemMitha My mother died from Alzheimer's disease. When serious memory loss started to set in, she would be very scared. She would not know where she was or who the people around her were, and she wanted to go back home "to mom and dad". I think she got used to it after some time though. She always recognised me, though did not know my name.
@FaheemMitha I think that's a common thought among elderly people. It really shines a light on your mortality when your peers start to die of natural causes but is probably much more intense when all or almost all of them have passed.
Youtube has started giving me 400 errors in the last few days. Probably an Indian thing, but just in case, is anyone else seeing it?
@Jesse_b My mother also has a history of depression. She was manic-depressive back in 199-1994. I was in India and with her at the time. It was very stressful.
But yes, it does have an impact when people you knew are dying around you.