0

Greetings and pardon the lengthy title,

To preface: I solved an issue where after downloading LibreOffice, the splash screen would show up, but nothing would happen afterwards

Below is the solution that fixed my issue: Step 1. SAL_DISABLE_OPENCL=1 soffice Step 2. libre office should open - open Tools -> Options -> LibreOffice -> OpenCL and disable the option "Allow use of OpenCL"

That being said, I'm trying to understand what happened in step 1. It appears to me that we are opening a subshell via the soffice command with the variable SAL_DISABLE_OPENCL changed in the context of said subshell

I've never seen or read about this before, and gave up trying to google the correct string of words. Does this concept have a name? I tried soffice --help but there is nothing to indicate this syntax

Any help is greatly appreciated, thanks!

  • This is not specific to `LibreOffice`. It is shell syntax for setting an environment variable. – kaylum Jun 20 '20 at 05:55
  • Many thanks for the response! Allow me to clarify: if I were to create a variable like so... ```HELLO="hi"``` ...then run a cmd that (to me) appears the same as the SAL_DISABLE.. cmd in Step 1 above... ```HELLO="hello" ls ; echo $HELLO``` ...to me, IF my example here were the same as the LibreOffice fix above, the output in the subshell should change the value of ```HELLO``` to ```hello``` However, it remains ```hi``` - unchanged from the original declaration Therein lies my confusion Thanks again! – kierkegaard Jun 20 '20 at 06:13
  • In your example `HELLO` is expanded by the **current** shell before it even runs the subprocess. So it becomes `HELLO="hello" ls; echo hi`. To do an equivalent test you need a program that reads the `HELLO` variable inside its code. – kaylum Jun 20 '20 at 06:17
  • Many thanks again! I’m still not really understanding it, but I think it has to do with my still being new to Linux. All the same, your help is much appreciated – kierkegaard Jun 20 '20 at 17:07

1 Answers1

1

Running SAL_DISABLE_OPENCL=1 soffice runs the program soffice passing to it the environment variable SAL_DISABLE_OPENCL set to the value 1. It does not run a subshell, it is run on your current shell. This syntax is described in the bash manual:

The environment for any simple command or function may be augmented temporarily by prefixing it with parameter assignments, as described in Shell Parameters. These assignment statements affect only the environment seen by that command.

That environment variable is a value treated specially by LibreOffice to force that option to be disabled.

Leonardo Dagnino
  • 2,914
  • 7
  • 28
  • This is fantastic! That explains it perfectly, I didn’t even know there was a bash manual. Gonna spend the next few days pouring over that, you are awesome – kierkegaard Jun 20 '20 at 17:10
  • The GNU manuals are sometimes hard to find if you don't know they exist. They should also be available in a Linux system by running `info bash`, but to be honest I never bothered learning to use `info`. One thing I like to do when I know what I'm looking for is opening the [single-page manual](https://www.gnu.org/software/bash/manual/bash.html) and doing a ctrl+f for the terms I want to know more about (actually how I found that section in the answer!) – Leonardo Dagnino Jun 20 '20 at 18:07
  • Also if you could accept the answer that would be great :) – Leonardo Dagnino Jun 20 '20 at 18:07