4 ms·
> The default FreeBSD shell is tcsh. I was prepared to not have bash, but tcsh is quite alien in its syntax compared to regular POSIX sh. All FreeBSD scripts I
by jlg23 7y ago
> The default FreeBSD shell is tcsh. I was prepared to not have bash, but tcsh is quite alien in its syntax compared to regular POSIX sh.
All FreeBSD scripts I encountered use posix shell.
> does have a dependency on perl to get the current time in seconds from the Unix epoch. This is because FreeBSD's date does not have a way to get milliseconds in the time
One could just install the GNU coreutils (probably, not checked though, much less overhead than a full perl install) or kill that problem with very few lines of C.
- Arnavion 7y agoYes, I would've done that for a regular FreeBSD install. But as I wrote a little before that part, because it was a pfSense install, I decided not to install any additional `pkg` packages myself.
- Lammy 7y agoYou could use a kqueue timer to run your script once per second: https://wiki.netbsd.org/tutorials/kqueue_tutorial/#index4h2 https://wiki.netbsd.org/tutorials/kqueue_tutorial/#index4h2
- AdamN 7y agoGNU coreutils are also available (and useful) on MacOS.
- michaelsbradley 7y agobrew install bash coreutils findutils gawk parallel
- JoshTriplett 7y ago> All FreeBSD scripts I encountered use posix shell. Defaults matter, and it's helpful when the default shell for command-line use matches the shell used for scripting, because people often do scripting on the command line.
- jlg23 7y agoShell scripts are usually interoreted by the interpreter defined in the shebang and /bin/sh is a posix sh.
- JoshTriplett 7y agoThat's my point: the shell used on the command line should use similar syntax to the shell people most commonly use for scripting.
- petre 7y ago/bin/sh is mostly intended for scripts, less so as an interactive user shell. It needs to be small, fast and as bugfree as possible, as opposed to offering a plethora of user interactive features. That's why FreeBSD uses sh and debian uses dash for this purpose.
- throw0101a 7y agoTell that to Debian/Ubuntu as well: default user shell is Bash, default /bin/sh is dash. If you need more-than-POSIX in your scripts, then use the proper shebang.
- JoshTriplett 7y agoI use Debian, and I'm aware. Bash still uses primarily POSIX sh syntax, with extensions. It's helpful for people to be able to apply knowledge from the command line to shell scripting and vice versa, even if they have to do a bit of porting work, rather than using completely different shells and syntax.
- bakul 7y agoThe default shell (what "adduser" offers as the default login shell) in FreeBSD is sh (/bin/sh). The root's shell is /bin/csh given FreeBSD's BSD roots. Though pfsense may have changed its defaults compared to a stock FreeBSD release.