The Cookie Machine - Click here to drag window

DUMMY TEXT - Real text set in assets/js/theCookieMachine.js

If you can read me, I'm broken!

Views: 994β€…    Votes:  3β€…
Tags: command-line   bash  
Link: πŸ” See Original Answer on Ask Ubuntu ⧉ πŸ”—

URL: https://askubuntu.com/q/1169391
Title: Expand $PATH problem $HOME/bin is set twice
ID: /2019/08/29/Expand-_PATH-problem-_HOME_bin-is-set-twice
Created: August 29, 2019    Edited:  August 30, 2019
Upload: September 15, 2024    Layout:  post
TOC: false    Navigation:  false    Copy to clipboard:  false


Ubuntu is already configured to automatically add $HOME/bin to the path.

You mentioned you’re distribution was Server converted to Desktop and I’m not sure how that effects things but you can check:

$ cat ~/.profile

# ~/.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 directories
PATH="$HOME/bin:$HOME/.local/bin:$PATH"

It sounds like this is being executed and what you are manually doing is doubling up on the last line in the file.


Using grep to find all references

You can use grep to find all the files where $HOME/bin is referenced:

grep -rnw --exclude-dir={proc,root,run,sys,/tmp,tmpfs,var} '/' -e "$HOME/bin"
⇧ How to take a serial port connection via USB online? How to pass 2>/dev/null as a variable?  β‡©