• Vehicles • Fashion • Recipes • Blogs • Hunt • Travels • Sport • Fun • Handmade • IT • Education
Mini-Games
x

x
zakruti.com » IT - Software » IT, programs, coding
How To Use Shell Environment Variables DistroTube

How To Use Shell Environment Variables DistroTube

FBTwitterReddit

video description

Rating: 4.0; Vote: 1
How To Use Shell Environment Variables DistroTube In this video, I am going to give a cursory introduction to shell environment variables, which come in two forms: global variables and local variables. I also discuss some of the global variables that I often use, including the PATH variable and how to add to the PATH. - https://www.gnu.org/software/bash/manual/html_node/ - Bash Reference Manual
Date: 2022-03-30

Comments and reviews: 10


I'm gonna try to offer some constructive criticism, since I feel like this was of lower quality than, say, your org-mode videos.
One mistake you're making here is trying to reword and rename concepts, to the point of being technically wrong.
For instance, your usage of -local- vs -global- variables doesn't match what is actually local vs global variables in shell scripting. You meant -variables- vs -environment variables-, because that's what Bash (and POSIX) names them.
Questions that I think should have been answered in the video:
- What is a variable?
- What is the environment?
- How do you add, change or remove a variable in the environment?
- How do you modify the environment only for the child process?
- What are the standard ways to persistently customize the environment?
That last one is the single most useful information for people that don't want to dive into shell programming, yet you devoted the least amount of time to it.
- -Why does my PATH have the same location twice?-
- -Why does my shell see the variable, but the script I invoke doesn't?-
- -Why isn't -/.config/environment.d working is the documentation says it should work?- (Spoiler: because systemd.)

reply

Actually, Environment variables are defined in the process that run any program, not just Shells.
And in Bash, and other Shells, there are variables in the Shell (Bash has both local and global variables in the Shell).
Environment variables are the ones in the process.
The Good thing is that Environment variables are copyed to the child process. Then the parent process can't change them for the child process.
And No process can change any other process Environment variables. Not even the patents.
MS Dos have global Environment variables, so any process can change any other programs Environment variables. Which is bad.

reply

It's a pity there's not a good -shell agnostic- way of setting global environment variables for things like XDG compliance... at least not when you include the fish shell in the criteria for -shell agnostic.- I know you could edit .profile or /etc/profile or something... but the whole point of forcing XDG compliance is to get rid of things like .profile.
I suppose you could set the default shell to bash and just have bash set the variables and launch fish, and I think the variables might persist to the fish session and your desktop environment... but eh. Such a hack.

reply

I don't have mouseface. not in repo. I found it in Github. Can someone please tell me the command to download it. The Github-clueless among us would appreciate it. I do have fortune though. The first time I tried it I got this : Q: How many existentialists does it take to screw in a light bulb? A: Two. One to screw it in and one to observe how the light bulb itself symbolizes a single incandescent beacon of reality in a netherworld of endless absurdity reaching out to a maudlin cosmos of nothingness.
reply

Great video! Thanks for the education.
Like a script-kiddie, I was just copy/pasting the line: PATH=-$HOME/Applications:$PATH- (changing -Applications- to whatever I needed to add) without fully understanding the simple syntax. Now I do. This means worlds to me!
I also agree that a playlist of these UNIX/Linux/POSIX commands would be great to help find them all.

reply

Sorry DT but there are actual definitions for concepts of local and global variable, and that's not it. Since you're being (for a good reason!) followed by total newbies, you really shouldn't be playing it fast and loose. Oher people may at a later point need to un-teach incorrect concepts before they can learn correct ones; and that's a bi-ch job.
reply

Bro can you make a video on how we can setup our own cross platform terminal that can run all the commands of bash and cmd it will be really cool if you could make a video on this topic.
reply

hey dt!, i have a question, how can i make the dtos installer?, like when you launch dtos installer it is a GUI INSIDE TERMINAL LIKE NCURSES HOW CAN I DO THAT?
reply

The PATH stuff was getting to me. I have been wanting to dig deeper into this but never did. Your short and sweet description on how to add paths was a Godsend!
reply

Hey DT, the range 32767 is int with size 2 (byte). So for a variable defined with integer size 2 can store -32768 to 32767. Thanks for the videos.
reply
Add a review, comment






Other channel videos