bash vs sh: parameter not set

Reminder: We're an English-only site.

The onus is on the OP to translate to and from English.
 


Grazie per avermi costretto a usare Google Translate...
Sorry, i'm not english, and i forgot to translate in english
I file nascosti sono preceduti da un "." . I file nascosti esistono per distinguerli dai file non nascosti e non vengono visualizzati a meno che tu non ne faccia esplicita richiesta.
But I knew this
Dato che ovviamente non vuoi provare a interagire con me in una discussione, usa Google per cercare "hidden file" e impara a fare ricerche da solo.
As I said at the beginning (my fault)...
And anyway there is no need to be touchy.
 
Trying things (setting variables, editing the ./bashrc) and then applying them is one way to learn how things work with Linux. If you don't like the results you get, you can always undo what you've modified.
You're right, but sometimes I happen to not be at the computer, or not have time to try.
 
As I said at the beginning (my fault)...
And anyway there is no need to be touchy.
since you are asking for help and information, you need to respect our need for clear and convenient posts. People tend to get annoyed and bewildered when you talk to them in ways that are hard to deal with, it's just a fact of life, get used to it. This computer stuff is already confusing enough as it is, I am very experienced with linux and command line stuff but nobody knows everything.

Variables are just ways for the shell (and computer programs in general) to remember and re-use information. They also allow computer users to go back and change the information, if the value needs to be set to something else. Three of the variables you posted must have PROBABLY "worked" because they are set by default, as a lot of variables are.

If you're getting "parameter not set", that means the variable is not set, and whatever command you entered needs it to be set to work.

if you get a value like "1000" (value for non-root users), that means it is set. Users on a linux system typically get assigned values in the thousands. The root zero has a value of 0.

if you get nothing at all, that also indicates the variable is not set.
 
You're right, but sometimes I happen to not be at the computer, or not have time to try.
Thanks, and, I get it.
Life is busy to say the least.
 
since you are asking for help and information, you need to respect our need for clear and convenient posts. People tend to get annoyed and bewildered when you talk to them in ways that are hard to deal with, it's just a fact of life, get used to it. This computer stuff is already confusing enough as it is, I am very experienced with linux and command line stuff but nobody knows everything.

Variables are just ways for the shell (and computer programs in general) to remember and re-use information. They also allow computer users to go back and change the information, if the value needs to be set to something else. Three of the variables you posted must have PROBABLY "worked" because they are set by default, as a lot of variables are.

If you're getting "parameter not set", that means the variable is not set, and whatever command you entered needs it to be set to work.

if you get a value like "1000" (value for non-root users), that means it is set. Users on a linux system typically get assigned values in the thousands. The root zero has a value of 0.

if you get nothing at all, that also indicates the variable is not set.
Good confirmation, thanks.

Does the variable have to be set in the ./basrc?
 
Thats just if you want it set after you restart your computer or end your shell session, otherwise you can just type:

variable=value

At the command line
Thanks!
 
@whired123 , if you are asking whether the "variable=value" format shown in post #31 will work, the answer is yes. It can be shown from the command line such as here:
Code:
[~]$ XXX=hello
[~]$ echo $XXX
hello
[~]$ unset XXX
[~]$ echo $XXX

[~]$
In the above code, the variable XXX is set, and shown to be set with the echo command, and then unset in which case it's removed as a variable. To make the variable work more broadly in the user's processes rather than just in the terminal in which it is set, as it was in the above example, one can place it in the user's .bashrc file. To have the variable recognised system-wide, one can set the variable in /etc/environment.

If you are asking something else with your cryptic "Nothing?" in post #31, then it would be useful if you expanded your text with a more comprehensible query which could get a more targeted response.:).
 
Last edited:
You're right, but sometimes I happen to not be at the computer, or not have time to try.
I get that.
There's only so much time in every day.
 
If you are asking something else with your cryptic "Nothing?" in post #31, then it would be useful if you expanded your text with a more comprehensible query which could get a more targeted response.:).
In the ~/.bashrc file, the variables must be set like this

Code:
XXX=...

or like this

Code:
export XXX=...
 
In the ~/.bashrc file, the variables must be set like this

Code:
XXX=...

or like this

Code:
export XXX=...
Thanks for that clarification.

The difference between "XXX=hello" and "export XXX=hello", is that the first one is a shell variable, and the second one is an environment variable.

When a shell variable like "XXX=hello" is set in the .bashrc file, it only exists in the current bash shell which is shown in the example in post #32. That doesn't mean just the terminal one uses, but all the terminals one might use when the current bash shell is being used.

As soon as one opens a second bash shell, that shell variable will no longer apply. For example in the following, a new bash shell is being used, but the variable doesn't extend to that new bash shell:
Code:
[~]$ XXX=hello
[~$ echo $XXX
hello
[~]$ bash -c echo $XXX

[~]$

To have the shell variable apply to all instances of bash, one needs to export the variable, in which case it becomes an "environment" variable. For example

Code:
[~]$ export XXX=hello
[~$ echo $XXX
hello
[~]$ bash -c "echo $XXX"
hello
[~]$

In the above code, the exporting has extended to the new bash shell invoked. Note the quotation marks which are necessary in this case I think.

Another alternative for setting environment variables is using the /etc/environment file mentioned in post #32.

It's worth noting that default important variables set by the system like PATH, are exported from their configuration files. For example in the case of PATH in /etc/profile:
Code:
if [ "$(id -u)" -eq 0 ]; then
  PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
  PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
fi
export PATH
In the above, PATH is set and then exported, so it applies system wide for all shell instances.
 


Follow Linux.org

Members online


Latest posts

Top