- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Time Output
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2004 03:25 PM
03-25-2004 03:25 PM
Time Output
On a server, running the following:
# ssh username@hostA "env | grep TZ"
... produces no result, yet:
# ssh username@hostA "echo $TZ"
gives the timezone. How can the TZ variable be set and yet not reflected in "env"?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2004 03:32 PM
03-25-2004 03:32 PM
Re: Time Output
Try this though:
Try loading the environment in the command line
ssh username@hostA "./etc/profile;.$HOME/.profile;env | grep TZ"
I'm interested in the result. Seeme the environment appears not fuly loaded
I've had to do environment loads prior to running scripts in ssh mode. There may be a command line option to force the load. I'm checking.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2004 04:07 PM
03-25-2004 04:07 PM
Re: Time Output
Please check this link:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=78306
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2004 06:57 PM
03-25-2004 06:57 PM
Re: Time Output
Thanks so far but it didn't help situation.
To further elaborate:
1. Both commands essentially does a ssh connection to "hostA" and runs the command "env| grep TZ" and "echo $TZ".
2. Now, if TZ was not set in one case, as shown by "env | grep TZ", it should not show not show up in the 2nd command either via "echo $TZ". Which is the bit which I have no explanation for.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2004 07:11 PM
03-25-2004 07:11 PM
Re: Time Output
Your suggestions gave me further ideas for testing.
# ssh username@hostA ". /etc/profile;. $HOME/.profile;env | grep TZ"
>> Shows TZ in "env".
ssh username@hostA ". $HOME/.profile;env | grep TZ"
>> TZ setting in "env" is gone.
Still probing, thanks for all help so far.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2004 07:17 PM
03-25-2004 07:17 PM
Re: Time Output
A variable only is listed by 'env' command when that variable has been exported. For instance, see carefully the two next examples:
# first example. Output is empty
HPHPHP=hello
env | grep '^HPHPHP'
# second example. Output is
export HPHPHP=hello
env | grep '^HPHPHP'
HPHPHP=hello
Other issue is what your second command line prints a TZ value. This is due because that value is not from 'hostA', but from the computer you launch the ssh command (let's call it 'myhost'). Before running the ssh, shell running in 'myhost' substitutes "$TZ" for its value, then (for instace TZ variables contains the value UTC),the command executed is:
# ssh username@hostA "echo UTC"
To see the value of TZ variable in hostA you should use single quotes instead:
# ssh username@hostA 'echo $TZ'
I hope this be useful.