[Issue 21059] New: install.sh: posix_terminal returns false on Linux Mint 20

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jul 20 14:22:03 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=21059

          Issue ID: 21059
           Summary: install.sh: posix_terminal returns false on Linux Mint
                    20
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dlang.org
          Assignee: nobody at puremagic.com
          Reporter: john.michael.hall at gmail.com

As originally discussed at 
https://forum.dlang.org/post/jvslnzlphrvjffixymys@forum.dlang.org


I just upgraded a machine to Linux Mint 20 on a fresh install and tried to run
the install script. It fails with
main: line 178: USERPROFILE: unbound variable

This line should only be called on Windows, which I found strange. It turns out
that this is driven by

```
posix_terminal() {
    # If this script is run on Windows cmd by passing it as argument to
bash.exe,
    # the shell level will be 1. If it is run from a POSIX terminal, it will be
> 1.
    if [ "$SHLVL" = 1 ]; then
        false
    else
        true
    fi
}
```

Running `echo $SHLVL` prints `1`

Running
```
bash
echo $SHLVL
```
prints `2`


Running `echo $SHELL` prints `/bin/bash`

The issue seems to be related to an update to Ubuntu 16:
https://askubuntu.com/questions/856532/why-is-shlvl-initially-2-in-ubuntu-16-10-but-not-earlier-versions

--


More information about the Digitalmars-d-bugs mailing list