Link to home
Start Free TrialLog in
Avatar of parlepoint
parlepoint

asked on

how i can export private & public variables and alias in ssh login

hi guys..

i want to do ssh and i want use same private & public( variable and alias) in remote machine.
how can i declare those variable in alias?
Avatar of nitinsawhney
nitinsawhney
Flag of India image

Best option would be to copy the contents of your .profile/.bash_profile to the same file on remote mahine.

Creating alias is simple just open your *profile* file and add

alias myAlias="some shell command"

e.g. alias LS = "ls -latr"

Hope this information is of some help.

Cheers!
Forgot to mention.
profile file may be named differently depending upon the shell you use.

If you are using bash then don't forget to do execute source .bash_profile after adding any new entry to the profile file.
> how i can export private & public variables and alias in ssh login
depends on your shell,
# sh and friends
  (set; alias) >myvarsandaliases

# csh and friends
  (set; printenv; alias) >myvarsandaliases
Avatar of parlepoint
parlepoint

ASKER

i have korn shell will it be work ??
where i have to give this command???
> i have korn shell ..
  (set; alias) >myvarsandaliases

> where i have to give this command???
  on the command line, obviously ...
do i have to make changes in .cshrc file...or what..
> do i have to make changes in .cshrc file...or what..
no

BTW, why would you change .cshrc when you use ksh?
Did you ever read any manual about your shell?

do i have to use this command to set alias...like this

set alias my='cd /home/mytest/myresult'



no (at least not in ash, bash, csh, esh, ksh, lsh, pdksh, rsh, sh, tcsh, tsh, zsh, ...)
then what command i have to use...
command for what?

http:#20005501
ASKER CERTIFIED SOLUTION
Avatar of parlepoint
parlepoint

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial