Currently I'm setting up a new system using the new Xubuntu trusty tahr. I'm not very familiar with shell scripting, but I have one which needs the OSTYPE environment variable to determine what to do.
If I call echo $OSTYPE
in the xfce-terminal I get succesfully linux-gnu
.
If I call following script I only get an empty line.
#!/bin/sh
echo $OSTYPE
Am I missing something or is it maybe a problem of the new ubuntu?
On another machine of mine it works with that script. But I don't know if something was changed for that, because the system was originally not mine.
The ostype (sometimes called LUN multiprotocol type) specifies the OS of the host accessing the LUN. It also determines the layout of data on the LUN, the geometry used to access that data, and the minimum and maximum size of the LUN.
$() – the command substitution. ${} – the parameter substitution/variable expansion.
The OSTYPE
environment variable is not recognized by the original Bourne shell, which is what is being invoked by the first line of your script.
Replace it with:
#!/bin/bash
or
#!/bin/ksh
as appropriate to your setup.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With