-4

I know that the "layer" architecture of any *nix OS is kernel-shell-utility ("inner to outer").

if we installed say Debian-Server and got some CLI utilities with it,
Should all these utilities work the same with all shells (Bash, Dash, Korn, etc)?
In other words, are Linux utilities (which I assume are kernel-dependent) also shell-dependent?

  • You get no problem invoking them from perl or python, why should there be a problem running them from a different shell? – DannyNiu May 11 '19 at 2:27
  • I don't know what you mean by "invoking them from perl or python" - I never worked with perl or python before. – JohnDoea May 11 '19 at 3:37
  • Read Operating Systems: Three Easy Pieces since an entire book is needed to answer your question. Also, write your own shell or at least study the source code of some existing one. – Basile Starynkevitch May 11 '19 at 5:17
  • I edited the question hoping now it's better. Sometimes it can be very hard to phrase a good question. I gave about 17 minutes to phrase it the start. – JohnDoea May 11 '19 at 5:45
  • This previous question, taking a Dennis Ritchie quote maybe too seriously, is relevant for readers. – Michael Homer May 11 '19 at 7:41
3

I know that the "layer" architecture of any *nix OS is kernel-shell-utility ("inner to outer").

It isn’t. Everything runs on top of the kernel, and “utilities” which aren’t shell scripts don’t need a shell, and are therefore not dependent on a specific shell.

Some programs do need others, for example a Wayland client needs a Wayland compositor. But there’s no general layering involving shells.

|improve this answer|||||
  • 1
    If you want clarifications, leave comments instead of suggesting edits. – Stephen Kitt May 11 '19 at 6:01
1

I'm assuming that by "shell" you are referring to the particular shell that you use as the login shell of your Unix system.

Software on your machine may well depend on a particular shell, but it will not depend on the shell that you use as your personal login shell (i.e. it will not depend on the login shell just because it's your login shell).

A utility that happens to be implemented as a script (or partly as a script) may use e.g. /bin/sh or some other shell to do certain things, but it would work exactly the same way if your login shell was bash, zsh or yash, or some more esoteric shell, just like a Python script would work the same for everyone regardless of what shell they use.

Remember that Unix is a multi-user operating system, and as such, command line utilities as well as graphical applications, would work the same regardless of what command line shell any one user uses (the "plumbing", i.e. syntax for launching the utility, may differ slightly, but it would be consistent within any user's shell).

For an example of a utility that uses a shell script, see e.g. the firefox executable on some systems (this may be a shell script that launches the actual firefox binary). Some types of compilers, e.g. OpenMPI, are implemented as shell script wrappers around the actual compiler. Again, programs that does this would work the same regardless of what shell the user is using as their login shell.

On the other hand, a shell script written for e.g. zsh will not work reliably when executed by another shell. This should be no surprise as replacing the interpreter of any script with another one may well break that script (for example, running a Perl script with the Ruby interpreter is likely to fail).

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.