OSTYPE is not available in shell script

I am currently setting up a new system using the new Xubuntu trusty tahr. I am not very good at shell scripts, but I have one that requires an OSTYPE environment variable to determine what to do.

If I call echo $OSTYPEin xfce terminal, I get successfully linux-gnu.

If I call the following script, I get only an empty string.

#!/bin/sh
echo $OSTYPE

Am I missing something or could it be a problem with the new ubuntu?

On my other machine, it works with this script. But I do not know if something has been changed for this, because the system was not originally mine.

+8
source share
1

OSTYPE Bourne, , script.

:

#!/bin/bash

#!/bin/ksh

.

+7

Source: https://habr.com/ru/post/1538976/


All Articles