Ask Your Question

CE> /usr/lib64/libreoffice/program/soffice: line 54: dirname: command not found [closed]

asked 2018-04-09 04:28:45 +0200

eddiesengola gravatar image

updated 2018-04-09 07:55:43 +0200

Run a java program that uses LibreOffice Java API to convert a doc into pdf file using a Bash script on the Linux terminal and I am getting this error. Any idea how to resolve it?

FYI, Using Eclipse I am able to run the program successfully.

But using a Bash script to run the program on the Linux terminal, I am getting this error below.

CE> /usr/lib64/libreoffice/program/soffice: line 54: dirname: command not found CE> /usr/lib64/libreoffice/program/soffice: line 124: grep: command not found CE> /usr/lib64/libreoffice/program/soffice: line 130: uname: command not found CE> /usr/lib64/libreoffice/program/soffice: line 161: /home/Programs/ACS2CC_Print2PDF_Integration/oosplash: No such file or directory

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2021-05-05 16:23:50.292800


Hi Eike,

This time, I used with my own user login account not the root account. Getting the same error. Here is the content of my user login's .bash.profile file.


Get the aliases and functions

if [ -f ~/.bashrc ]; then . ~/.bashrc fi

User specific environment and startup programs

export PATH

export PATH=/usr/sbin:$PATH


export PATH

export TMP=/tmp export TMPDIR .................................

eddiesengola gravatar imageeddiesengola ( 2018-04-09 23:25:54 +0200 )edit


FYI, I installed LibreOffice, using the root account. Thank you again for your help.


eddiesengola gravatar imageeddiesengola ( 2018-04-09 23:32:59 +0200 )edit


grep is in /usr/bin.

in my login account's .bash_profile, I only set the below, and still getting the same error.

export PATH=/usr/sbin:/bin:/usr/bin

eddiesengola gravatar imageeddiesengola ( 2018-04-10 08:05:36 +0200 )edit

2 Answers

Sort by » oldest newest most voted

answered 2018-04-09 11:56:34 +0200

erAck gravatar image

updated 2018-04-09 11:59:28 +0200

Make sure your bash shell's PATH environment variable has set /usr/bin and maybe /bin (depends on the distribution which path grep is installed to), so echo $PATH should display at least /usr/bin or maybe /usr/bin:/bin somewhere in the output.

edit flag offensive delete link more

answered 2018-04-09 21:53:18 +0200

eddiesengola gravatar image

Hi Eike,

Thanks for the feedback.

I did it as you can see below. /usr/bin is included.

[root@wcserverone# echo $PATH


edit flag offensive delete link more


  1. Please don't post comments as answers. It is not an answer to the original question.

  2. You should not run such things as root.

  3. The content containing a literal $PATH string is wrong. Check the script that is assembling that content.

  4. Check that the PATH variable is actually exported and not just local to the script that sets the variable.

erAck gravatar imageerAck ( 2018-04-09 22:15:12 +0200 )edit

Hi EiKe,

Many Thanks for your hints and suggestions.

The issue was that since I was executing my own bash script to run the java program, I had to include in that bash script, the following: /usr/bin/grep:/usr/bin:/bin:/root/bin:usr/bin on the below:

export PATH=${JAVA_HOME}/bin.

So, setting this below in my bash script, did the trick. Never updated my user login account's .bash_profile

export PATH=${JAVA_HOME}/bin:/usr/bin/grep:/usr/bin:/bin:/root/bin:usr/bin

eddiesengola gravatar imageeddiesengola ( 2018-04-10 09:27:37 +0200 )edit

Note that /usr/bin/grep is the executable and thus listing it in PATH is superfluous. And usr/bin (without leading /) at the end looks odd. That adds a usr/bin search path relative to the current work directory (which may even be harmful).

erAck gravatar imageerAck ( 2018-04-12 14:11:36 +0200 )edit

Question Tools

1 follower


Asked: 2018-04-09 04:28:45 +0200

Seen: 755 times

Last updated: Apr 09 '18