Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Is there a command or a man page where I could view the shell variables available? I have a test tomorrow and we can use the man pages or built in commands, but not text files. I don't feel like memorizing them.
Yes right when u do man <name of shell> say man bash, you will see that shell's available keyword and variables.
For my homework, I am supposed to use an environment variable to display the ip address of the machine. I can't find the environment variable. Perhaps it isn't listed? I am not sure what to do.
Sounds strange.. At least on my machine, the IP address(s) are not stored in any environment variable that I'm aware of. What have you tried so far to look at the environment variables that ARE configured, and WHERE exactly are you looking, when you say "perhaps it's not listed"?
Also, it's a good practice to tell us what Linux, and which shell (if applicable) you are using. In this particular case, neither of these really matter a great deal, but as a rule, if you're looking for help, let us know what Linux you are running (especially as it seems you are posting from Windows).
Sounds strange.. At least on my machine, the IP address(s) are not stored in any environment variable that I'm aware of. What have you tried so far to look at the environment variables that ARE configured, and WHERE exactly are you looking, when you say "perhaps it's not listed"?
Also, it's a good practice to tell us what Linux, and which shell (if applicable) you are using. In this particular case, neither of these really matter a great deal, but as a rule, if you're looking for help, let us know what Linux you are running (especially as it seems you are posting from Windows).
Kind regards, and welcome to LQ
Sasha
I am using CentOS and I am using bash. I checked the man pages for bash environment variables and didn't see anything for IP addresses. I am assuming it is a default one because the assignment has instructions for all the variables we are to set beforehand and this wasn't one of them. Here is the exact question from the assignment:
Using values from Environment Variables only, identify the following?
Your computer’s IP address: _____________________ (Variable Name: ____________________)
This assignment is only for practice for the test, so it isn't crucial. Worst comes down to it, I lose a few marks on the test.
Hmm.. Well, for your info, check out the man page for the `env` command, just for educational reasons. You will see there a way to use the `env` command to view the currently configured environment, that is, all currently set environment variables.
I meant the IP for my computer--as reported by "ifconfig". This is--I think--unambiguously my address as seen from outside my box. Obviously, if I'm on a router, someone on the other end will see something else.
Well, I ran 'set' and 'env' on my system (Centos 5.4) and it's definitely not there. I can only imagine that the test machine will have it set specifically and you'll see it with one of those cmds.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.