LinuxMint 19 $PATH

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
extre248
Level 1
Level 1
Posts: 5
Joined: Thu May 16, 2019 7:12 am

LinuxMint 19 $PATH

Post by extre248 »

Hi everyone. Very new to Linux, Mint is the first OS I have installed. Always used Windows and Windows 10 really turned me off my PC so here I am trying to rehash my old love for computers.
So far so good, OS is great. Very different to the last linux install I did way back in probably 2005!! How far it has come! Great work!

Anyhow so im trying to learn how this thing works, so starting with shell scripts. I have been following this simple procedure without any luck :roll:

http://linuxcommand.org/lc3_wss0010.php

Created a bin directory at /home/coolmint/bin

Created a simple script showing some System Info called "System_Info" and saved it in that bin directory.

Chmod it to 755

Im trying to set my PATH so I can call on scripts directly from this directory in terminal without having to cd to it.

Currently

Code: Select all

coolmint@coolmint-desktop:~$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

I have edited the .profile file and restarted the terminal only to get "Command not found". Ive googled and tried a few things only to fail setting up this simple setting.

.profile file

Code: Select all

# ~/.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

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi
export PATH="$PATH:/home/coolmint/bin"
export PATH=$PATH:/home/coolmint/bin
export PATH=/home/coolmint/bin:$PATH
Can someone show me so I can grasp what I am missing?

AscLinux
Level 4
Level 4
Posts: 342
Joined: Sat Oct 29, 2016 3:32 pm

Re: LinuxMint 19 $PATH

Post by AscLinux »

In case your shell is bash this should work in ~/.bash_profile

Code: Select all

PATH=$PATH:/home/<user>/bin

extre248
Level 1
Level 1
Posts: 5
Joined: Thu May 16, 2019 7:12 am

Re: LinuxMint 19 $PATH

Post by extre248 »

Thanks for the advice.

I didnt have a /.bash_profile file that I could see anywhere but I added

Code: Select all

export PATH=$PATH:/home/coolmint/bin
to /.bashrc and typing echo $PATH into terminal is showing the change!
Spent 2 hrs trying to figure this out!! lol. It will be a long road but hopefully well worth it! I should probably learn what these bash files are all about now.

User avatar
smurphos
Level 17
Level 17
Posts: 7067
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher
Contact:

Re: LinuxMint 19 $PATH

Post by smurphos »

You just needed to log out and back in after creating your bin folder. The default ~/.profile is read at logon time and would have added the new folder to your $PATH at that point.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.

extre248
Level 1
Level 1
Posts: 5
Joined: Thu May 16, 2019 7:12 am

Re: LinuxMint 19 $PATH

Post by extre248 »

I thought I must have been missing something simple and if I had not got any response here a reboot was my next plan of attack. Thanks for letting me know.

Post Reply

Return to “Newbie Questions”