0

ksh export name="bhargav"

csh setenv name bhargav

Trying like this and from windows Iam using plink command to get the variable value. But it showing the error undefined variable

Bhargav Teja
  • 431
  • 6
  • 19
  • Post the full command-line you are using for plink. For the user-account on the target unix hostname, its shell startup file(s) for that user needs to define any variables you might want. – mao Jul 29 '17 at 05:49
  • In Linux .kshrc `export name="bhargav"`, In windows plink command is `plink -pw password ec2-user@10.0.0.0 "echo $name"` – Bhargav Teja Jul 29 '17 at 06:00

1 Answers1

0

For the target-user, does Linux have bash or ksh as the shell for that user? If Linux is configured with bash as the shell, then ensure that the ~/.bashrc exports that variable. If Linux is configured with ksh as the shell for the user account (instead of bash), try exporting the variable in ~/.profile

mao
  • 11,321
  • 2
  • 13
  • 29
  • Iam using ksh. $0 is showing -ksh. When I am executing plink command from windows `plink -pw password ec2-user@10.0.0.0 "echo $0" ` output is -ksh – Bhargav Teja Jul 29 '17 at 08:01
  • So plink does not invoke the shell startup, which is the reason your variable is not initialized . See https://stackoverflow.com/questions/3407386/plink-does-not-source-bashrc-or-bash-profile-on-connect – mao Jul 29 '17 at 08:41