In FreeBSD 14 system default shell for the root.

Hello.
In FreeBSD 14 system, default shell for the root became sh?
Why sh?
Code:
root@serv0:~ # echo $SHELL
/bin/sh
root@serv0:~ # id
uid=0(root) gid=0(wheel) groups=0(wheel),5(operator)
root@serv0:~ # uname -rms
FreeBSD 14.0-RELEASE amd64
 

Because csh has several limitations and unintuitive behavior.

Furthermore, most users use a sh variant for interactive use. So when you want to help them you give them sh syntax commandlines. Which would then work in sudo but not in su if root's shell is csh.
 
Note that you don't HAVE to change root's shell to /bin/sh, you can keep /bin/csh if you want. I'm so used to csh(1) I've kept mine that way. While sh(1) has certainly seen a lot of improvement lately it's still awfully spartan for interactive use. But then you could also make the argument that I shouldn't be constantly logged in as root.
 
Hi guys,

In my manuals when installing I usually use commands similar to this a lot:

CSH (FreeBSD <= 10.2) example:

# mkdir -p /tmp/test{1,2,3}



# ls /tmp | grep test

Code:
test1
test2
test3

Is there a way to do this same thing with SH?

SH (FreeBSD >= 14.0) example:

# ???


Thank you for your answers!
 
Pretty convoluted but something like this: for d in 1 2 3; do mkdir -p /tmp/test${d}; done.

Code:
dice@fbsd-test:~ % sh
$ for d in 1 2 3; do mkdir -p /tmp/test${d}; done
$ ls -ld /tmp/test*
drwxr-xr-x  2 dice wheel 2 Dec 13 14:58 /tmp/test1
drwxr-xr-x  2 dice wheel 2 Dec 13 14:58 /tmp/test2
drwxr-xr-x  2 dice wheel 2 Dec 13 14:58 /tmp/test3
 
Hi guys,

In my manuals when installing I usually use commands similar to this a lot:

CSH (FreeBSD <= 10.2) example:

# mkdir -p /tmp/test{1,2,3}



# ls /tmp | grep test

Code:
test1
test2
test3

Is there a way to do this same thing with SH?

SH (FreeBSD >= 14.0) example:

# ???


Thank you for your answers!

zsh is a feature-rich sh variant that knows these tricks. Note that it isn't fully compatible with sh scripts, but for interactive use it is close enough.
 
Back
Top