Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am having problems with simple scripting, my Box is CentOS so bash is the default shell, now I wanted to send a line via setenv (tcsh) and would like to make a script that will ask me to input a string to setenv every time I login.

By the way I am using teraterm logging in.

share|improve this question

setenv belongs to (t)csh, not to bash which is the default shell in CentOS. Use export instead. Ref : bash setenv command is not found

Then considering you would input MY_VARIABLE=MYVALUE

echo -n "Enter the env string"
read env
echo export "$env" >> $HOME/.bash_profile
. $HOME/.bash_profile

Edit : I have modified my code as the previous one would not really export env to all bash shell considering. This one will but the variable in the bash_profile file which is executed each time a bash is opened.

share|improve this answer
Thank you will try this now – tibay May 30 '14 at 4:04
Consider revising my post, I modified the code for a more efficient one. – Jean-François Savard May 30 '14 at 13:42

I have tested it and I think my program needed the setenv

So what I need now is to set my shell to tcsh and then ask for the setenv.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.