1

I added a path where my own scripts reside which is executing fine when I give absolute paths in the terminal to execute. I read that adding path of such directory in the list of paths will enable them to to execute anywhere from terminal instead of giving absolute paths every time. So here I modified the path in the /etc/environment file and added the new path at the end. The file shows the newly added path but I'm unable to execute the programs. So what needs to be done to achieve that?

And ~/.profile is not found, I'm writing this because that's where most have redirected to add paths. I use linux mint and /etc/environment is where I found all the paths listed in the file. Thank you.

EDIT

# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
    . "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

PATH="$HOME/Software/android-studio/bin/:$PATH"

I created and added this to my .profile file and still unable to execute the script or should I do it differently.

EDIT(1)

I simply typed export PATH="$HOME/Software/android-studio/bin/:$PATH" in terminal and now it works although I would like to know where does this list of paths exist and why does the .profile solution didn't work

  • Your .profile is only executed when you log in. You can also add this in .bash_rc which is executed when a command prompt is started. – xenoid Jun 24 '17 at 20:30
  • Even that is not present. Should I create that too? – Pb Vignesh Jun 24 '17 at 20:34
  • Your change looks fine, you just need to login (or execute . ~/.profile (the dot-blank is important so the script runs in your current shell not a child shell which exits immediately with no changed path) – eckes Jun 24 '17 at 20:50
1

/etc/environment is only used for login, so you won't see anything before you logoff & logon. You can source it in a shell as a temporary measure. But IMHO this isn't the place to change your path.

You should really have a ~/.profile, but remember that due to the leading dot it doesn't show unless explicitly requested (ls ~/.*, or "Show hidden files" in your file explorer).

However, if you create your own scripts you can keep them in ~/bin (create if necessary) as this directory is automatically included in you PATH(*). If you want to use another directory, .profile is the right place to extend the path, but if you use them only from bash you can also add them in .bash_rc file (another one with a leading dot).

(*) My Ubuntu-installation-created .profile contains:

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi
  • Yea I know it's a hidden file. I checked for it and google around a bit, now in process of creating one myself. So I'll just write it the way you've posted – Pb Vignesh Jun 24 '17 at 19:44
  • I have edited the question after creating the .profile file – Pb Vignesh Jun 24 '17 at 20:07
0

By any chance, does that program rely on lsb?

If it does, install the lsb base package:

apt install lsb  

It's a problem I've ran into before with RedCine's X converter on Linux, with the same symptoms.

Confirm lsb's availability:

lsb_release -a

That should print out your release and more importantly, the LSB modules you're running.

  • For now I just tested it by adding location of android studio. Didn't work. – Pb Vignesh Jun 24 '17 at 19:25

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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