This question already has an answer here:

When I enter this command in a terminal window, it works as expected:

ifuse "/home/sadi/mnt"

But it is ineffective when used in a bash script run via a .desktop file.

What can I do to use it like that?

This command (supposed to mount a connected device in the specified folder) is preceded by mkdir -p "/home/sadi/mnt", and followed by nautilus --no-desktop --new-window "/home/sadi/mnt" both of which work perfectly both in terminal and in bash script.

type ifuse output = /home/sadi/usr/bin/ifuse and I have this in my .bashrc: export PATH="${HOME}/usr/bin:${PATH}"

marked as duplicate by Christopher, GAD3R, Gilles bash Jan 10 '17 at 0:00

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


You have set the PATH inside ~/.bashrc, but ~/.bashrc is only fully sourced if the starting shell is interactive.

It is usual to have an statement equivalent to:

[ -z "$PS1" ] && return  # If not running interactively, don't do anything

Which will make your setting of PATH:

export PATH="${HOME}/usr/bin:${PATH}"

simply in-effective if placed after the test for PS1 when used inside a no-interactive script.

  • Thanks, but my question is What can I do to use the command ifuse like that? – Sadi Jan 9 '17 at 22:17
  • 1
    @Sadi Place the PATH setting command before the [ -z "$PS1 ] ?. Place a PATH command in ~/.profile (so all scripts will have the correct PATH set) ? Set the PATH in ~/.bash_profile so only bash is affected by the PATH change ? – sorontar Jan 9 '17 at 22:46
  • Thank you very much! I haven't studied this area yet ;-) Simply adding the new PATH section at the end of ~/.profile did the trick although it includes ~/.bashrc earlier which includes If not running interactively, don't do anything strings. – Sadi Jan 10 '17 at 6:34

Not the answer you're looking for? Browse other questions tagged or ask your own question.