The Cookie Machine - Click here to drag window

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

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

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: November 24, 2022    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"

# set PATH so it includes user's private bin directories

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?  β‡©