User action with external command

142 views
Skip to first unread message

Ciro Santilli

unread,
Apr 4, 2012, 9:06:43 AM4/4/12
to krusader-users
I want to run a script cmd.sh which is in my ~/mycommands/ folder
inside a user action without specifying the full path.

I added this folder to my PATH variable by adding the lines

PATH=$PATH:~/mycommands/
export $PATH

to my ~/.bashrc, but user actions still does not see my cmd.sh script,
even if I use the run in terminal option.

In capture output mode, it keeps saying that there is no such script,
and if I do echo $PATH in the user action, my directory ~/mycommands/
is not present. If I open a terminal however and do cmd.sh, the
command is found. Any ideas what I am doing wrong?

r2ruy...@yahoo.de

unread,
Apr 4, 2012, 2:49:27 PM4/4/12
to krusade...@googlegroups.com
Hi Ciro!

The file ~/.bashrc ist not read by your _login_ shell and thus the PATH is not
as you want it from krusaders point of view. For more information, just google
for "bash login shell".

Basically you have two options:

1) Start krusader from your shell (since that one reads the ~/.bashrc)
2) Edit one of ~/.bash_profile, ~/.bash_login, or ~/.profile and modify your
PATH there. The changes take effect on the next login.

r2ruyu-nana

Ciro Santilli

unread,
Apr 5, 2012, 5:37:58 AM4/5/12
to krusade...@googlegroups.com
Thank you so much for the quick response!

You are right, putting into ~/.bash_profile, ~/.bash_login, or ~/.profile works.

If I may bother you some more, I have searched for a while now, but I am not sure what is really happening. Does this work because every program I run from my Gnome GUI (by doing Super + Krusader + Enter) is actually being run from the same login shell, which has been running somewhere on the background since I logged in without me knowing it? I am confused because this is not clearly stated anywhere, and to me 'login' is putting my user and password on the startup Ubuntu GUI.

r2ruy...@yahoo.de

unread,
Apr 6, 2012, 3:46:33 PM4/6/12
to krusade...@googlegroups.com, Ciro Santilli
On Thursday 05 April 2012 02:37:58 Ciro Santilli wrote:
> If I may bother you some more, I have searched for a while now, but I am
> not sure what is really happening. Does this work because every program I
> run from my Gnome GUI (by doing Super + Krusader + Enter) is actually being
> run from the same login shell, which has been running somewhere on the
> background since I logged in without me knowing it? I am confused because
> this is not clearly stated anywhere, and to me 'login' is putting my user
> and password on the startup Ubuntu GUI.

Hi!

The "login shell" stuff was misleading from my side. If you login at one shell
at Ctrl+Alt+F1... your bash will read the login/profile configs mentioned above
(login shell). If you start a terminal in your desktop environment the bash
will not read these files since you aren't logging in...

Probably you login via a (gaphical) login/display manager, which will read
e.g. ~/.profile:

"""
~/.profile - This is probably the best file for placing environment variable
assignments, since it gets executed automatically by the DisplayManager during
the start-up process desktop session as well as by the login shell when one
logs-in from the textual console.
"""
https://help.ubuntu.com/community/EnvironmentVariables

...but it seems that's not the prefered method anymore. At least for Ubuntu.
Some clever login manager might see that your default shell is bash and will
therefore also read ~/.bash_profile...but that's just an assumption from my
side.

r2uryu-nana

Reply all
Reply to author
Forward
0 new messages