after ssh how can i use existing script variable

Posted on 2007-10-01
Last Modified: 2013-12-23
hi guys,

i am doing ssh for working in remote machine, some of the private and global variables are declared in existing sctipt but those are not in remote server, how can i export all command.
After ssh i have to entered so many lines of command , do i have to use script or is there any other way??
is there any command i can find all private & global vaible used in script.
Question by:parlepoint
    LVL 43

    Accepted Solution

    > is there any command i can find all private & global vaible used in script.
    bash will print them using
    printenv # will show globals (env)
    set # will print all, global and locals

    Do You want ssh client to copy local variables to remote server? You can do that (but only env variables, the exported ones)

    ssh -2 -o "SendEnv VAR_NAME" user@remote.tld
    of course server have to be configured to accept env variables, which is NOT(!) default.

    Author Comment

    hi..this is very useful information.
    is there any command so we can see all private variable used by shell script.
    LVL 43

    Expert Comment

    Only private, I dont know.
    Otherwise: set

    Author Comment

    set don't give you private ??right??
    LVL 43

    Expert Comment

    It gives. But it gives globals as well(globals == env variables)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    The DSL Parameters part of this article is valid and can be considered with any brand of internet router and modem (Dlink, 3com, Alcatel, Usrobotics, Parks), by accessing the configuration interface available by the manufacturer eg: …
    Don’t let your business fall victim to the coming apocalypse – use our Survival Guide for the Fax Apocalypse to identify the risks and signs of zombie fax activities at your business.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now