LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-19-2022, 12:50 PM   #1
Faki
Member
 
Registered: Oct 2021
Posts: 574

Rep: Reputation: Disabled
User defined environment variables


Is it possible to have a user define an environment variable in bash, that can be used is subsequent terminal instances to set the verbosity of certain functions using that variable.
 
Old 09-19-2022, 01:01 PM   #2
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,665

Rep: Reputation: Disabled
Yes it is.
 
Old 09-19-2022, 01:10 PM   #3
Faki
Member
 
Registered: Oct 2021
Posts: 574

Original Poster
Rep: Reputation: Disabled
With the condition that the user can enable or disable the environment variable functionality without the need to change their ".bashrc" directly.
 
Old 09-19-2022, 01:24 PM   #4
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,665

Rep: Reputation: Disabled
Quote:
Originally Posted by Faki View Post
With the condition that the user can enable or disable the environment variable functionality without the need to change their ".bashrc" directly.
When posting homework questions it is expected you show us what have you done already and where you get stuck.
 
Old 09-20-2022, 09:55 AM   #5
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,997

Rep: Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338
looks like you don't understand it, or I don't understand the question.
You can't modify a shell from another terminal/console/whatever, a running process cannot be altered by setting some environment variables outside (anywhere).
But you can export variables which will be inherited by the child processes (and therefore will be taken into account) - obviously if they will not be lost or overwritten by something like .bashrc or similar.
 
Old 09-20-2022, 03:07 PM   #6
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,147
Blog Entries: 6

Rep: Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834
OP, why don't you try it for yourself.
Code:
man export
 
1 members found this post helpful.
  


Reply

Tags
bash, environment variable



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How Are Environment Variables Defined In A Gnome Terminal Session? kurama LinuxQuestions.org Member Intro 2 01-13-2018 09:47 AM
How are environment variables defined in a Gnome terminal session? bodisha Linux - Newbie 6 12-22-2017 03:45 AM
User defined linux commands in a user defined shell Sushma05 Linux - Newbie 3 09-13-2013 07:21 AM
user defined variables linuxdev Linux - Newbie 4 02-09-2004 12:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:11 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration