Re: Configuring terminal and referencing username in bash scripts.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello

Terminal emulator does not care those files but check what shell you are using
echo $SHELL


You can find all environmet variables with command
env
to see if some of them will tell current username.



--
mr. M01510 & guide Loadstone-GPS  Lat: 62.38718, lon: 25.64672
hkp://wwwkeys.pgp.net B784D020 fp:0C1F6A76 DC9DDD58 33838B5D 0E769600 B7840D02
http://sokkona.arimo.info


 Linux for blind general discussion kirjoitti
Subject: Configuring terminal and referencing username in bash scripts.
Date: Wed, 26 Apr 2023 22:22:49
From: Linux for blind general discussion <blinux-list@xxxxxxxxxx>
To: Linux for blind general discussion <blinux-list@xxxxxxxxxx>

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@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@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/blinux-list


_______________________________________________
Blinux-list mailing list
Blinux-list@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/blinux-list




[Index of Archives]     [Linux Speakup]     [Fedora]     [Linux Kernel]     [Yosemite News]     [Big List of Linux Books]