Upgrade to FreeBSD 12.2-RELEASE and OSTYPE environment variable

David Christensen dpchrist at holgerdanske.com
Sun Feb 14 20:40:03 UTC 2021

On 2021-02-14 07:08, Daniel Lysfjord wrote:
> "David Christensen" skrev 14. februar 2021 kl. 04:59:
>> freebsd-questions:
>> I am upgrading my FreeBSD 12.1-RELEASE machines to 12.2-RELEASE. The upgrade process seemed to go
>> smoothly, but afterwards I noted that the OSTYPE environment variable still has the old value:
>> 2021-02-13 19:56:02 toor at f1 ~
>> # freebsd-version ; uname -a
>> 12.2-RELEASE-p3
>> FreeBSD f1.tracy.holgerdanske.com 12.2-RELEASE-p3 FreeBSD 12.2-RELEASE-p3 GENERIC amd64
>> 2021-02-13 19:56:11 toor at f1 ~
>> # env | grep -i freebsd
>> OSTYPE=freebsd12.1
>> Please advise.
>> David

> On one of my machines, the OSTYPE env is nowhere to be found, on another machine it's just "FreeBSD". I've never set it to anything. Both are running 12.2-P3

I use FreeBSD via packages; I do not have source installed.  My shell is 

2021-02-14 12:08:45 toor at f2 ~
# bash --version | head -n 1
GNU bash, version 5.1.4(0)-release (amd64-portbld-freebsd12.1)

RTFM bash(1):

        OSTYPE Automatically set to a string that describes the operating
               system on which bash is executing.  The default is system-

/usr/local/share/doc/bash/CHANGES has more details:

x.  Bash no longer auto-exports HOSTNAME, HOSTTYPE, MACHTYPE, or OSTYPE,
     even if it assigns them default values.
s.  HOSTTYPE, OSTYPE, and MACHTYPE are set only if they do not have values
     when the shell is started.

Searching my system, I do not see an assignment to OSTYPE:

2021-02-14 12:03:33 toor at f2 ~
# find -x / -type f | xargs grep 'OSTYPE' | grep '=' | egrep -v 
/usr/local/share/doc/bash/bashref.html:<span id="index-OSTYPE"></span>
/usr/local/share/doc/bash/bashref.html:<tr><td></td><td valign="top"><a 
href="#index-OSTYPE"><code>OSTYPE</code></a>:</td><td> </td><td 
valign="top"><a href="#Bash-Variables">Bash Variables</a></td></tr>
/usr/local/lib/perl5/5.32/Perl/OSType.pm:my %OSTYPES = qw(

But I do see:

2021-02-14 12:04:30 toor at f2 ~
# grep OSTYPE `which bash`
Binary file /usr/local/bin/bash matches

So, the answer should be in the Bash source.


More information about the freebsd-questions mailing list