Help with manipulating environmental variables in UNIX


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help with manipulating environmental variables in UNIX
# 1  
Old 12-18-2012
Help with manipulating environmental variables in UNIX

I am wondering if there is away to increment a date in c shell. What I need to do is basic, but I lack the knowledge.

I have they following environmental variable in my job scripts

Code:
setenv YYYY `date '+%Y'`

I then set YYYY to be part of my output dataset name:

Code:
setenv dd_OUTPUTP "build$YYYY.dat"

So when I run the job script, it creates a dataset named build2012.dat.

I need to have the dataset be build2013.dat.

Is there a way to increment $YYYY by 1 to give me the next year.

Thanks.

Last edited by fpmurphy; 12-19-2012 at 03:08 AM.. Reason: fixed typo
# 2  
Old 12-18-2012
try:
Code:
@ YYYY++

This User Gave Thanks to rdrtx1 For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

<< Environmental Variables are not set when script completes >>

Hi Team, I have a wrapper script which i have pasted below, it internally calls one python script to generate Environmental in a file called /home/oracle/myenv.sh, when i execute this script via wrapper script, its not reflecting in my current session, still showing old env variables. any... (2 Replies)
Discussion started by: kamauv234
2 Replies

2. OS X (Apple)

Don't understand the practical difference between command aliases and environmental variables

Hey, I'm recently learning Unix from the video course by Kevin Scoglund. I'm stuck at the moment where he goes into Environmenat variables. I have some issues with understanding what's the essential difference between EV and command aliases: for instance, by writing the command alias ll='ls... (3 Replies)
Discussion started by: scrutinizerix
3 Replies

3. Shell Programming and Scripting

Manipulating variables in shell script

Hello, I know this should be simple but cant find a solution yet.I have the following in a sh script called "var" #!/bin/bash var1=0 And on another script called "main" I use a if construct: #!/bin/bash . var if then Do this else do that fi Now in "do this" part,I have to change... (8 Replies)
Discussion started by: vijai
8 Replies

4. Shell Programming and Scripting

Manipulating env variables for user apache?

So that they can be used in a cgi script? How best to do this? Thanks ---------- Post updated at 06:24 PM ---------- Previous update was at 02:38 AM ---------- Anyone that can help me with this? Basically I want to add an environment variable that will be visible to the cgi scripts when I... (0 Replies)
Discussion started by: stevenswj
0 Replies

5. Shell Programming and Scripting

Oracle environmental variables in shells script

Hi, Getting below error on executing the shell script which initiates sqlplus How to set oracle enviornment variables in the shell script ? With Regards (3 Replies)
Discussion started by: milink
3 Replies

6. AIX

Best way to setup my own environmental variables ?

I am writing a few korn scripts to be used by all our operators on several 4.1/4.2 AIX servers. I want to create environmental variables that once set, can be read/modified by my scripts (ex: specific folders, file names, conventions, general values, ...). I thought this would be better then... (4 Replies)
Discussion started by: Browser_ice
4 Replies

7. Shell Programming and Scripting

[bash] command line substitution with environmental variables

Hi, I'm using an array that contains compiler FLAGS that need to be executed either before ./configure or after the main 'make' command. example of array containing compiler flags. ------------------------------------------------- FLAGS="CFLAGS=\"-arch x86_64 -g -Os -pipe... (7 Replies)
Discussion started by: ASGR
7 Replies

8. UNIX for Dummies Questions & Answers

Unix passing environmental Variables

In my script when I change an env variable in the parent shell it is only changed for that session - it there away to change it permanently using a script so that when I use rlogin (create a child session) that the env variable is set correctly? Basically what I am trying to do is to pass a... (7 Replies)
Discussion started by: belfastbelle
7 Replies

9. Shell Programming and Scripting

Manipulating awk $variables using sed?

I have been searching around the forums here trying to find a solution to my problem but not getting anywhere but closer to baldness. I have a 20 column pipe "|" seperated text file. The 14th variable doesnt always exist, but will have the format of YYYYMM or YYYY if it does. I need to take... (2 Replies)
Discussion started by: r0sc0
2 Replies

10. UNIX for Advanced & Expert Users

Environmental Variables - where stored ?

Hi all ! Yesterday I defined an environmental variable PATH, but today when I restarted machine, I could not see that it was stored any place. Is there any file where I could save the settings ? I have quite a few env.variables defined, so I need a smarter way to define. regards D (5 Replies)
Discussion started by: DGoubine
5 Replies
Login or Register to Ask a Question