Skip to main content
added 45 characters in body
Source Link
iconoclast
  • 9.5k
  • 14
  • 65
  • 100

I believe you cannot always get the current shell's name, and I think you shouldn'tshould be aware of the limitations of what is possible.

On Linux distributions, most users would have bash as their login & interactive shell (since bash is the default shell on most distros). Some users would set their shell to zsh, csh (and variants) or to fish.

(As other comments and answers explain, finding reliably the shell out of bash, zsh, tcsh, fish is already challenging)

But some weird users may set their login shell to something entirely different - a Lisp interpreter, scsh, es, some scripting language à la Python, or Ocaml, or Perl, etc...- and it is their freedom to do so. Probably, some people are coding their own shell and using it interactively. Even if you found their strange shell, you won't be able to do anything useful of it (hence I believe you shouldn't try to get the shell's name).

So I guess that you are coding some sourceable file (perhaps generating one) to configure some software. So just explain what you are doing, and code for the common case of bash (and perhaps zsh & tcsh) ....

I believe you cannot always get the current shell's name, and I think you shouldn't.

On Linux distributions, most users would have bash as their login & interactive shell (since bash is the default shell on most distros). Some users would set their shell to zsh, csh (and variants) or to fish.

(As other comments and answers explain, finding reliably the shell out of bash, zsh, tcsh, fish is already challenging)

But some weird users may set their login shell to something entirely different - a Lisp interpreter, scsh, es, some scripting language à la Python, or Ocaml, or Perl, etc...- and it is their freedom to do so. Probably, some people are coding their own shell and using it interactively. Even if you found their strange shell, you won't be able to do anything useful of it (hence I believe you shouldn't try to get the shell's name).

So I guess that you are coding some sourceable file (perhaps generating one) to configure some software. So just explain what you are doing, and code for the common case of bash (and perhaps zsh & tcsh) ....

I believe you cannot always get the current shell's name, and I think you should be aware of the limitations of what is possible.

On Linux distributions, most users would have bash as their login & interactive shell (since bash is the default shell on most distros). Some users would set their shell to zsh, csh (and variants) or to fish.

(As other comments and answers explain, finding reliably the shell out of bash, zsh, tcsh, fish is already challenging)

But some weird users may set their login shell to something entirely different - a Lisp interpreter, scsh, es, some scripting language à la Python, or Ocaml, or Perl, etc...- and it is their freedom to do so. Probably, some people are coding their own shell and using it interactively. Even if you found their strange shell, you won't be able to do anything useful of it (hence I believe you shouldn't try to get the shell's name).

So I guess that you are coding some sourceable file (perhaps generating one) to configure some software. So just explain what you are doing, and code for the common case of bash (and perhaps zsh & tcsh) ....

added 60 characters in body
Source Link

I believe you cannot always get the current shell's name, and I think you shouldn't.

On Linux distributions, most users would have bash as their login & interactive shell (since bash is the default shell on most distros). Some users would set their shell to zsh, csh (and variants) or to fish.

(As other comments and answers explain, finding reliably the shell out of bash, zsh, tcsh, fish is already challenging)

But some weird users may set their login shell to something entirely different - a Lisp interpreter, scsh, es, some scripting language à la Python, or Ocaml, or Perl, etc...- and it is their freedom to do so. Probably, some people are coding their own shell and using it interactively. Even if you found their strange shell, you won't be able to do anything useful of it (hence I believe you shouldn't try to get the shell's name).

So I guess that you are coding some sourceable file (perhaps generating one) to configure some software. So just explain what you are doing, and code for the common case of bash (and perhaps zsh & tcsh) ....

I believe you cannot always get the current shell's name, and I think you shouldn't.

On Linux distributions, most users would have bash as their login & interactive shell (since bash is the default shell on most distros). Some users would set their shell to csh (and variants) or to fish.

(As other comments and answers explain, finding reliably the shell out of bash, zsh, tcsh, fish is already challenging)

But some weird users may set their login shell to something entirely different - a Lisp interpreter, scsh, es, some scripting language à la Python, or Ocaml, or Perl, etc...- and it is their freedom to do so. Probably, some people are coding their own shell and using it interactively. Even if you found their strange shell, you won't be able to do anything useful of it.

So I guess that you are coding some sourceable file (perhaps generating one) to configure some software. So just explain what you are doing, and code for the common case of bash (and perhaps zsh & tcsh) ....

I believe you cannot always get the current shell's name, and I think you shouldn't.

On Linux distributions, most users would have bash as their login & interactive shell (since bash is the default shell on most distros). Some users would set their shell to zsh, csh (and variants) or to fish.

(As other comments and answers explain, finding reliably the shell out of bash, zsh, tcsh, fish is already challenging)

But some weird users may set their login shell to something entirely different - a Lisp interpreter, scsh, es, some scripting language à la Python, or Ocaml, or Perl, etc...- and it is their freedom to do so. Probably, some people are coding their own shell and using it interactively. Even if you found their strange shell, you won't be able to do anything useful of it (hence I believe you shouldn't try to get the shell's name).

So I guess that you are coding some sourceable file (perhaps generating one) to configure some software. So just explain what you are doing, and code for the common case of bash (and perhaps zsh & tcsh) ....

added 29 characters in body
Source Link

I believe you cannot always get the current shell's name, and I think you shouldn't.

On Linux distributions, most users would have bash as their login & interactive shell (since bash is the default shell on most distros). Some users would set their shell to csh (and variants) or to fish.

(As other comments and answers explain, finding reliably the shell out of bash, zsh, tcsh, fish is already challenging)

But some weird users may set their login shell to something entirely different - a Lisp interpreter, scsh, es, some scripting language à la Python, or Ocaml, or Perl, etc...- and it is their freedom to do so. Probably, some people are coding their own shell and using it interactively. Even if you found their strange shell, you won't be able to do anything useful of it.

So I guess that you are coding some sourceable file (perhaps generating one) to configure some software. So just explain what you are doing, and code for the common case of bash (and perhaps zsh & tcsh) ....

I believe you cannot always get the current shell's name, and I think you shouldn't.

On Linux distributions, most users would have bash as their login & interactive shell (since bash is the default shell on most distros). Some users would set their shell to csh (and variants) or to fish.

(As other comments and answers explain, finding reliably the shell out of bash, zsh, tcsh, fish is already challenging)

But some weird users may set their login shell to something entirely different - a Lisp interpreter, scsh, es, some scripting language à la Python, or Ocaml, or Perl, etc...- and it is their freedom to do so. Probably, some people are coding their own shell and using it interactively. Even if you found their strange shell, you won't be able to do anything useful of it.

So I guess that you are coding some sourceable file (perhaps generating one) to configure some software. So just explain what you are doing, and code for the common case of bash ....

I believe you cannot always get the current shell's name, and I think you shouldn't.

On Linux distributions, most users would have bash as their login & interactive shell (since bash is the default shell on most distros). Some users would set their shell to csh (and variants) or to fish.

(As other comments and answers explain, finding reliably the shell out of bash, zsh, tcsh, fish is already challenging)

But some weird users may set their login shell to something entirely different - a Lisp interpreter, scsh, es, some scripting language à la Python, or Ocaml, or Perl, etc...- and it is their freedom to do so. Probably, some people are coding their own shell and using it interactively. Even if you found their strange shell, you won't be able to do anything useful of it.

So I guess that you are coding some sourceable file (perhaps generating one) to configure some software. So just explain what you are doing, and code for the common case of bash (and perhaps zsh & tcsh) ....

Source Link
Loading