• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 624
  • Last Modified:

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?
0
parlepoint
Asked:
parlepoint
  • 5
  • 5
  • 2
1 Solution
 
nitinsawhneyCommented:
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!
0
 
nitinsawhneyCommented:
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.
0
 
ahoffmannCommented:
> 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
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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

> where i have to give this command???
  on the command line, obviously ...
0
 
parlepointAuthor Commented:
do i have to make changes in .cshrc file...or what..
0
 
ahoffmannCommented:
> 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?
0
 
parlepointAuthor Commented:

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

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



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

http:#20005501
0
 
parlepointAuthor Commented:
i did not understand how to give this command

  (set; alias) >myvarsandaliases

0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 5
  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now