chsh

I know that chsh is used for changing your shell but I can't where this information is stored.

echo $SHELL shows bash so I know I have used the command, but I'd like to know where this is held.

Anyone know?
 
The user database, mate. Traditionally /etc/passwd but that file has long since been replaced with /etc/master.passwd.
I looked in /etc/passwd like ChatGPT suggested but there wasn't anything there, but using HI ;) it was where you suggested.

I changed it to zsh, but forget I hadn't yet installed it.

OOPS!!

Can't login.
 
When I was trying out chatgpt a while back, it insisted on using bash and I had to constantly correct it. It still hasn't learned the lesson that FreeBSD does not natively install bash. Is that the reason you are using bash?
I installed to be able to use mc. but have now replaced it zsh.
 
I looked in /etc/passwd like ChatGPT suggested but there wasn't anything there, but using HI ;) it was where you suggested.

I changed it to zsh, but forget I hadn't yet installed it.

OOPS!!

Can't login.

chsh should check the shell you select against /etc/shells, which in turn is maintained by pkg when you install shells. So this shouldn't have happened.

Unless you edited passwd in an editor and didn't go through chsh?
 
chsh should check the shell you select against /etc/shells, which in turn is maintained by pkg when you install shells. So this shouldn't have happened.

Unless you edited passwd in an editor and didn't go through chsh?
Here is my file. I don't know where these values come from and haven't even heard of some of these shells

/etc/shells :-
sh:
/bin/sh
/bin/csh
/bin/tcsh
/usr/local/libexec/git-core/git-shell
/usr/local/bin/bash
/usr/local/bin/rbash
/usr/local/bin/zsh
/usr/local/bin/rzsh

I never edit passwd.
 
Here is my file. I don't know where these values come from and haven't even heard of some of these shells

/etc/shells :-
sh:
/bin/sh
/bin/csh
/bin/tcsh
/usr/local/libexec/git-core/git-shell
/usr/local/bin/bash
/usr/local/bin/rbash
/usr/local/bin/zsh
/usr/local/bin/rzsh

I never edit passwd.
/etc/passwd is generated on editing /etc/master.passwd with vipw(8) (or with other tools like adduser(8)) using pwd_mkdb(8) for backward compatibility.

And considering risks of accidental deletion (i.e., caused by build failures of dependencies) and failed upgrades, directly setting shells from ports/pkgs as login shell would be discouraged.

FYI:
I'm configuring /bin/tcsh as login shell and have codes below in my ~/.tcshrc.mine and having blank ~/.Use_zsh.
Code:
if ( -X zsh && -f ~/.Use_zsh ) exec zsh

This way, if zsh cannot found in anywhere PATH environment variable specifies or ~/.Use_zsh does NOT exist, /bin/tcsh keeps on working as login shell, thus, doesn't fail to login.

Note that this is NOT helpful for failed upgrades (zsh in this case exists but doesn't run). I'm using this from when I was using UFS and having /usr/local as an independent partition.
And equivalent of option -X on /bin/{t}csh does NOT exist on /bin/sh.
 
When I was trying out chatgpt a while back, it insisted on using bash and I had to constantly correct it. It still hasn't learned the lesson that FreeBSD does not natively install bash. Is that the reason you are using bash?
The reason for many is probably default OS installs where the shell has no history, no normal working function keys or no command completion and the operator just wants to do some simple things without having to repeat anything all over because of a typing error. That's a crippled environment for no technical reason. Execute a working bash on a PC beyond 386, problem solved...
I have seen systems without backspace as default key meaning. Really?
 
MG No. Chatgpt just thinks FreeBSD uses bash by default
Because most online script resources are bash and many BSD people use it too? I personally would just mention a different shell in a prompt to make that clear anyway. Kind of a crucial keyword like in a search engine.
 
Here is my file. I don't know where these values come from and haven't even heard of some of these shells

/etc/shells :-
sh:
/bin/sh
/bin/csh
/bin/tcsh
/usr/local/libexec/git-core/git-shell
/usr/local/bin/bash
/usr/local/bin/rbash
/usr/local/bin/zsh
/usr/local/bin/rzsh

I never edit passwd.

zsh should only have ended up in your /etc/shells when you install zsh.
 
Because most online script resources are bash and many BSD people use it too?
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.
 
Claude correctly thinks about standard shells on FreeBSD, as does Qwen.

zsh is popular with BSDs, including macOS, because unlike bash it is not GPLed. I still think that bash is the most popular on FreeBSD for non-root accounts.
 
It was SirDice who told me preferable to switch to sh for root and user account. I liked this change. But when i need to write a script i use zsh , this not for compatibility , but for functionality , like even associative arrays.
 
I still think that bash is the most popular on FreeBSD for non-root accounts.
For me, bash is installed as BUILD_ and / or RUN_DEPENDS of something.
Not at all intentionally using directly.

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.
 
Back
Top