Configuring terminal and referencing username in bash scripts.

Linux for blind general discussion blinux-list at redhat.com
Wed Apr 26 19:22:49 UTC 2023


Okay, so I've been using a ~/.bash_profile file with the following contents:

rm -f ~/.bash_history
export PS1='$(tty | sed 's#^/dev/tty##')\$'
export PATH=~/Programming/bash-scripts:$PATH

To clear the command history from the previous session, change the
prompt to something extremely short instead of the default user at host
/path/to/working/directory, and to add the directory where I store my
bash scripts to my path.

It works when logging into the console, but I recently bought a new
desktop and decided to give running a full desktop a go since I'm no
longer running a 12-year-old CPU with 4GB of RAM, and whichever
terminal emulator Debian Mate uses by default is clearly ignoring
~/.bash_profile.

So is there somewhere I can put the above lines so they'll besourced
both when logging into a text-only console and when launching a
terminal emulator?

Also, I have some scripts to automate sshing into some remote hosts or
mounting the remote filesystems locally, and part of it involves
creating a mounttt point that needs to be chown to my user. Is there a
shell variable I can use to make these scripts work for any user
instead of needing to edit the script to use the name of the user I'm
logged in as?



More information about the Blinux-list mailing list