environmental problem running command via terminal window

Advertisement

Alexey
Guest

environmental problem running command via terminal window

Hi

I succesfully login to my acoount on FreeBSD machine. But when I open Terminal/Console window and issue 'env' command I don't see enviroment variables that have to be set in .bashrc file.

I want to run a bash script which uses some environment configured in .bashrc.

What could be a problem? Are there any workarounds?

Thanks,
Alexey

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

Re: environmental problem running command via terminal window

Some of the startup scripts are not executed for non-interactive sessions. Try to set your variables in other scripts (like .profile, .bash_profile, etc.)

Reply with quote

aphongka
Joined:
Posts:
4

Re: environmental problem running command via terminal window

martin wrote:

Some of the startup scripts are not executed for non-interactive sessions. Try to set your variables in other scripts (like .profile, .bash_profile, etc.)

Strange, but non of the files seems to work :( neither .bashrc, nor .bash_profile, nor .profile, nor .cshrc, nor /etc/profile. Are there any other ways to set up the environment while running a script?

Reply with quote E-mail

martin
Site Admin
martin avatar

Re: environmental problem running command via terminal window

Strange. Another hint: some variables are unset by WinSCP on start up. Maybe the one you need is among them. These variables are: LANG, LANGUAGE, LC_CTYPE, LC_COLLATE, LC_MONETARY, LC_NUMERIC, LC_TIME, LC_MESSAGES, LC_ALL, HUMAN_BLOCKS. You may uncheck the "clean national variables" on SCP tab of login window to avoid this. But WinSCP may not work then,

Reply with quote

Advertisement

aphongka
Joined:
Posts:
4

Re: environmental problem running command via terminal window

No, I setup PATH, LANG and some application specific variables.

Well when i use ssh from cigwin environment like

ssh -l user host.com env|sort

i see that .bashrc has run. The command like this

ssh -l user host.com
$>env|sort

shows that .bash_profile has run

But nothing has run with WinSCP. What is the problem? Is it a bug or a feature?

Reply with quote E-mail

martin
Site Admin
martin avatar

Re: environmental problem running command via terminal window

Can you try to add -T option to ssh command and check what, if any, script is executed? With -T option, 'ssh' should use then the same mode as WinSCP.

Reply with quote

aphongka
Joined:
Posts:
4

Re: environmental problem running command via terminal window

martin wrote:

Can you try to add -T option to ssh command and check what, if any, script is executed? With -T option, 'ssh' should use then the same mode as WinSCP.

first variant of ssh (non interactive) works with -T option too (I mean .bashrc is run)

second variant (interactive) hangs with -T option and I am not able to see if it works

Reply with quote E-mail

martin
Site Admin
martin avatar

Re: environmental problem running command via terminal window

I'm sorry, but I've runned out of ideas. I just works for me fine :-(

Reply with quote

Advertisement

You can post new topics in this forum