Topic "environmental problem running command via terminal window"

Author Message
Alexey

Guest


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
Advertisements
aphongka
[View user's profile]

Joined: 2004-09-17
Posts: 4
Forget to mention.

I use version 3.6.6 build 234
I use SCP protocol

/Alexey
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
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.)
_________________
Martin Prikryl
aphongka
[View user's profile]

Joined: 2004-09-17
Posts: 4
prikryl 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?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
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,
_________________
Martin Prikryl
aphongka
[View user's profile]

Joined: 2004-09-17
Posts: 4
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?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
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.
_________________
Martin Prikryl
aphongka
[View user's profile]

Joined: 2004-09-17
Posts: 4
prikryl 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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
I'm sorry, but I've runned out of ideas. I just works for me fine Sad
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License