Configuring terminal and referencing username in bash scripts.

Linux for blind general discussion blinux-list at redhat.com
Thu Apr 27 13:58:09 UTC 2023


     If it uses Mate terminal, the .bash_profile doesn't get read by 
default.  You could put them in .bashrc and it should read them when the 
terminal is opened.  I think .bashrc is read every time a shell is 
invoked, so that is something to be aware of.

You can also have Mate terminal invoke a script for you, but I've never 
done that.  Type man mate-terminal.




> 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?
>
> _______________________________________________
> Blinux-list mailing list
> Blinux-list at redhat.com
> https://listman.redhat.com/mailman/listinfo/blinux-list
>



More information about the Blinux-list mailing list