Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

2 Answers 2

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 at 4:04
    
Consider revising my post, I modified the code for a more efficient one. –  Jean-François Savard May 30 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

 
discard

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.