chsh

It would be nice if bash to POSIX-only sh script compiler exists and used for ports to compile bash scripts into scripts for /bin/sh.

That's difficult to do just for starters because of associative arrays. It's not that sh and bash are different and translateable, it is that sh lacks them entirely. No automatic conversion can exist that wouldn't tank performance for them.
 
Again, many does not equal most and that would hold it up as standard usage. Many people don't use bash, too. I'd even bet most BSD people use something else--especially sh. No one at my company ever used bash and neither did I. When I correct chatgpt it even apologizes for the error.
I don't think properties that make something a default shell exist. It's an OS project choice and only a way of executing a batch of system commands with a simple loop and condition structure. It doesn't change the system behaviour or possibilities. It's only a prompt loop and command interpreter. A few lines of C code can already be considered a shell. In the end it's all stdio. I prefer bash for as much as possible because it's a standard set by usercount over all *nix-like environments. I can't remember a situation where a different shell was needed. Maybe on a very old system that's low on resources. Running a legacy /bin shell might be a better option because the size and complexity of bash take too much loading and processing time.
 
I don't think properties that make something a default shell exist.
sh is the default shell on FreeBSD so I don't understand what you mean.
I prefer bash for as much as possible because it's a standard set by usercount over all *nix-like environments.
Except those *nix-like environments where it's not installed. On BSD, at least, you know sh will be there. You cannot know bash will be there.
Running a legacy /bin shell
The "/bin shell" is not legacy.
 
While upgrading, dependencies can be important
ldd /usr/local/bin/bash
Code:
/usr/local/bin/bash:
...
libintl.so.8 => /usr/local/lib/libintl.so.8 (0x3901a045c000)
 
should be,
cat passwd | grep root
root:*:0:0:Charlie &:/root:/bin/sh

same shell for regular user, eg,
x:*:1001:1001:x:/home/x:/bin/sh

Then type zsh on prompt if needed.
 
Maybe explain how I locked myself out of my system by chsh to zsh without zsh being installed.

It took me a while to break back it, and am still not sure how I managed it.

For getting back in, just use the root account that you didn't switch to an alternate shell.

As for not getting locked out in the first place - as I explained the protection here is that pkg only adds zsh to /etc/shells when it installs zsh. If zsh is not in /etc/shells chsh doesn't let you switch to it.

Since you apparently have zsh in /etc/shells and you didn't have zsh you have to start testing whether the zsh package is doing the right thing. Remove zsh pkg and see whether the entry in /etc/shells disappears. If not remove it manually and install zsh and see whether it gets correctly added.
 
If I'm locked out I don't have access to the filesystem.
but you can log as root and change user to csh or tcsh or sh shell and IMOthe problem is solved. And than do the correct with zsh shell.
First check if is install and before you swithed the shell firs try:
echo $SHELL will tell you current shell and than change to ZSH with type zsh] and you are in zsh shell.
 
Back
Top