Sponsored Content
Top Forums Shell Programming and Scripting Setting a TZ variable in a script Post 302569498 by maverick72 on Monday 31st of October 2011 01:40:52 PM
Old 10-31-2011
Hey,

Thanks for the reply.

Tried that already with the = in the cut and just passing the path name in the TZ variable.

Code:
./time_zone
export: 18: /usr/share/zoneinfo/Canada/Eastern: bad variable name
export: 18: /usr/share/zoneinfo/Asia/Hong_Kong: bad variable name
export: 18: /usr/share/zoneinfo/Asia/Hong_Kong: bad variable name

 

10 More Discussions You Might Find Interesting

1. Programming

setting CC variable

I am trying to install GCC-3.1.1 on an SGI Indigo2. I already have MIPSpro 7.2.1 installed. However, when I try to configure GCC-3.1.1, I get the message "cc ERROR: cc -o conftest -g failed, You must set the environment variable CC to a working compiler." What is the name of the MIPSpro c++... (1 Reply)
Discussion started by: mdbanas
1 Replies

2. UNIX for Dummies Questions & Answers

Setting a variable

I want to set a variable to be any number of dashes. Rather than doing the following: MYVAR="------------------" I'd like to be able to set the variable to, say, 80 dashes but don't want to have to count 80 dashes. Is there a way to do this? (2 Replies)
Discussion started by: photh
2 Replies

3. Shell Programming and Scripting

Setting basename and dirname variable to simply script.

Hello all, Can somebody explain to me how set up a basename and dirname variable to simplify this script. I currently have a 'infile' with the contents of FTTPDataPVC_ & BaaisDSLFeed. I need to add a basename and or dirname variable so that any additions can be made through the infile and not... (1 Reply)
Discussion started by: liketheshell
1 Replies

4. UNIX for Dummies Questions & Answers

setting a global variable in script

Hi All, I know to set global variable i can use export .. But take the situation like below .. I want to set a variable in one script and access that in second script i have done like this .. It is not working one.sh #!/usr/bin/ksh echo $RISSHI export RISSHI=1 two.sh... (3 Replies)
Discussion started by: arunkumar_mca
3 Replies

5. Shell Programming and Scripting

Setting environment variable on a remote solaris machine using shell script

Hi, I am trying to set environment variable on a remote machine. I want to do it by running a shell script Here's what I am doin rsh <remote-hostname> -l root "cd /opt/newclient; . ./setp.sh" In setp.sh, I have ############################# cd ../newlib; export... (1 Reply)
Discussion started by: eamani_sun
1 Replies

6. Shell Programming and Scripting

Help with setting a variable!

I am working within a while loop and i am trying to set a variable that will read out each count of the files. the problem is the count variable i have set up gives me a total and not the individual count of each file. in the data area there is 4 abc.dat and 1 def.dat. how can i do this??? ... (2 Replies)
Discussion started by: Pablo_beezo
2 Replies

7. Shell Programming and Scripting

Setting environment variable using shell script

Hi All, I'm trying to write an menu driven program to automate some functions which involve loging to multiple hosts. The hosts can differ for every use, so I thought I would use an config file to get the hostnames. Now I need to set those values in the config file to environment variable to... (6 Replies)
Discussion started by: arun_maffy
6 Replies

8. Shell Programming and Scripting

Setting a variable in a while loop (.ksh script)

Hello Everyone, I'm still trying to grasp many concepts in .ksh scripting, one of them being variables inside loops. My problem is the following: * I'm trying to set a variable inside a while read loop to reuse it outside of said loop. My lines are the following :... (13 Replies)
Discussion started by: jimmy75_13
13 Replies

9. Shell Programming and Scripting

setting a shell script variable in awk

The following is part of a larger shell script grep -v "Col1" my_test.log | grep -v "-" | awk '$5 == "Y" {print $1}' instead of printing, can I set set $1 to a variable that the rest of the shell script can read? if $5 == Y, I want to call another shell script and pass $1 as a... (2 Replies)
Discussion started by: guessingo
2 Replies

10. UNIX for Advanced & Expert Users

Setting a permanent global variable in unix accessible from any script

Is there anyway in which i can set a permanent global variable in unix, which when initialised with a value and modified during any shell script, would retain its value even if i logout and login I dont know whether i am being able to express my need clearly but basically what i want is a... (3 Replies)
Discussion started by: arindamlive
3 Replies
TZSET(3)						   BSD Library Functions Manual 						  TZSET(3)

NAME
tzset -- initialize time conversion information LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <time.h> void tzset(void); DESCRIPTION
The tzset() function uses the value of the environment variable TZ to set time conversion information used by localtime(3). If TZ does not appear in the environment, the best available approximation to local wall clock time, as specified by the tzfile(5) format file /etc/localtime is used by localtime(3). If TZ appears in the environment but its value is a null string, Coordinated Universal Time (UTC) is used (without leap second correction). If TZ appears in the environment and its value is not a null string: - if the value begins with a colon, it is used as a pathname of a file from which to read the time conversion information; - if the value does not begin with a colon, it is first used as the pathname of a file from which to read the time conversion information, and, if that file cannot be read, is used directly as a specification of the time conversion information. When TZ is used as a pathname, if it begins with a slash, it is used as an absolute pathname; otherwise, it is used as a pathname relative to /usr/share/zoneinfo. The file must be in the format specified in tzfile(5). When TZ is used directly as a specification of the time conversion information, it must have the following syntax (spaces inserted for clar- ity): stdoffset[dst[offset][,rule]] where: std and dst Three or more bytes that are the designation for the standard (std) or summer (dst) time zone. Only std is required; if dst is missing, then summer time does not apply in this locale. Upper- and lowercase letters are explicitly allowed. Any characters except a leading colon (:), digits, comma (,), minus (-), plus (+), and ASCII NUL are allowed. offset Indicates the value one must add to the local time to arrive at Coordinated Universal Time. The offset has the form: hh[:mm[:ss]] The minutes (mm) and seconds (ss) are optional. The hour (hh) is required and may be a single digit. The offset following std is required. If no offset follows dst, summer time is assumed to be one hour ahead of standard time. One or more digits may be used; the value is always interpreted as a decimal number. The hour must be between zero and 24, and the minutes (and seconds) -- if present -- between zero and 59. If preceded by a ``-'' the time zone shall be east of the Prime Meridian; otherwise it shall be west (which may be indicated by an optional preceding ``+''). rule Indicates when to change to and back from summer time. The rule has the form: date/time,date/time where the first date describes when the change from standard to summer time occurs and the second date describes when the change back happens. Each time field describes when, in current local time, the change to the other time is made. The format of date is one of the following: Jn The Julian day n (1 <= n <= 365). Leap days are not counted; that is, in all years -- including leap years -- February 28 is day 59 and March 1 is day 60. It is impossible to explicitly refer to the occasional February 29. n The zero-based Julian day (0 <= n <= 365). Leap days are counted, and it is possible to refer to February 29. Mm.n.d The d'th day (0 <= d <= 6) of week n of month m of the year (1 <= n <= 5, 1 <= m <= 12, where week 5 means ``the last d day in month m'' which may occur in either the fourth or the fifth week). Week 1 is the first week in which the d'th day occurs. Day zero is Sunday. The time has the same format as offset except that no leading sign ``-'' or ``+'' is allowed. The default, if time is not given, is 02:00:00. If no rule is present in TZ, the rules specified by the tzfile(5) format file posixrules in /usr/share/zoneinfo are used, with the standard and summer time offsets from UTC replaced by those specified by the offset values in TZ. For compatibility with System V Release 3.1, a semicolon (;) may be used to separate the rule from the rest of the specification. If the TZ environment variable does not specify a tzfile(5) format file and cannot be interpreted as a direct specification, UTC is used. FILES
/etc/localtime local time zone file /usr/share/zoneinfo time zone information directory /usr/share/zoneinfo/posixrules used with POSIX-style TZ's /usr/share/zoneinfo/GMT for UTC leap seconds If /usr/share/zoneinfo/GMT is absent, UTC leap seconds are loaded from /usr/share/zoneinfo/posixrules. SEE ALSO
ctime(3), getenv(3), strftime(3), time(3), tzfile(5) STANDARDS
The tzset() function conforms to IEEE Std 1003.1-1988 (``POSIX.1''). BSD
April 1, 2001 BSD
All times are GMT -4. The time now is 05:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy