06-06-2005
Setting Variables not working
Hi all,
I am trying to set up some variables in a shell script. The variables contain values of various paths needed to run a java module. The problem is the variables dont seem to be setting at all.
here is what i am trying to do :
JAR_HOME=/home/was5/bdcms/scheduledjobs/lib
export JAR_HOME
JAVA_HOME=/usr/java131/bin
export JAVA_HOME
SOURCE_HOME=/home/was5/bdcms/scheduledjobs/src
export SOURCE_HOME
CLASS_PATH=.:/home/was5/bdcms/scheduledjobs/src/classes12.jar
export CLASS_PATH
echo $CLASS_PATH
------------END of code -------------
This echo prints the value correctly. Where as if i do the same from unix prompt after executing the script, the variable is always empty. I have tried all kinds of things here(including export CLASS_PATH=value and export SET CLASS_PATH=value among others) and am not able to figure the problem.
Any help or pointers are appreciated.
Thanks
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi everyone,
I am trying to set up the .profile for a user I have just created. In trying to set up the shell variables, I want to make the shell be korn shell (default shell i believe is Borne shell), so, this is what I did:
SHELL=/usr/bin/ksh
export SHELL
Whenl executing the .profile,... (1 Reply)
Discussion started by: rachael
1 Replies
2. UNIX for Dummies Questions & Answers
Hello,
I want to set some environment variables with this script:
ip=$@
echo Remote Computer: $ip
PERLDB_OPTS="CallKomodo=$ip:9000 RemotePort=$ip:9010 PrintRet=0"
export PERLDB_OPTS
PERL5LIB=/opt/komodo
export PERL5LIB
echo PERLDB_OPTS: $PERLDB_OPTS
echo PERL5LIB: $PERL5LIB
But it... (5 Replies)
Discussion started by: Gargamel
5 Replies
3. Shell Programming and Scripting
hi All
I have a file that has 4 lines:
1. yesterday's date (mm/dd/yyyy)
2. yesterday's day- dd
3. yesterday's month- mm
4. yesterday's year- yyyy
I want to read this file and place them in variables. how can I do this.
Please help.
thanks in advance!!
KS (3 Replies)
Discussion started by: skotapal
3 Replies
4. Shell Programming and Scripting
I'm not quite sure what I'm doing wrong here.
I've go several jobs which print reports. Occassionally a printer will break down and reports need to be move to another printer. Rather than hard code the printer names in our scripts I'm trying to set these programatically
using our function... (1 Reply)
Discussion started by: BCarlson
1 Replies
5. UNIX for Advanced & Expert Users
i have a file .NAMEexport MY_NAME=JOE
when i do this at the command prompt #. .NAME
$echo MY_NAME
$JOEi created a script called Run.sh . .NAME At the command prompt i did #sh Run.sh
#echo $MY_NAMEit returns nothing. What have i missed out? (7 Replies)
Discussion started by: new2ss
7 Replies
6. UNIX for Dummies Questions & Answers
Hi all,
I have a shell script that sets up the environment for an application running on UNIX - ksh. This script is run using:
. ./script_name XX
where XX is a parameter. I want to run it from another shell script but when I do it I don't get the envornment variables set up and the prompt... (3 Replies)
Discussion started by: solar_ext
3 Replies
7. UNIX for Dummies Questions & Answers
hi all,
I would appreciate if some one could explain me the difference between setting up the variables as shown below
HOME=${HOME:-"/home/user1"}
HOME=/home/user1 (1 Reply)
Discussion started by: SSSB
1 Replies
8. UNIX for Dummies Questions & Answers
#!/bin/bash
if ; then
ASS1_DATA_DIR=./
echo $ASS1_DATA_DIR
export ASS1_DATA_DIR
echo "data dir"
fi
if ; then
ASS1_OUTPUT_DIR=./
export ASS1_OUTPUT_DIR
fi
I want to create a new environment variable ASS1_DATA_DIR and ASS1_OUTPUT_DIR in bash and set them to the current... (4 Replies)
Discussion started by: bigubosu
4 Replies
9. UNIX for Dummies Questions & Answers
Hi all,
This is my first post here. I need to set up a few environment variables with a shell script. Some are hard-coded, but some should come from other commands or as input from the user. How do I do that?
For example, I need to export a variable as such:
export DISPLAY=127.0.0.1:8.0
... (2 Replies)
Discussion started by: exchequer598
2 Replies
10. Shell Programming and Scripting
So I'm writing a script to generate pairwise scores for how similar two strings are, and while I've been able to get it to work on a single script, I've been unable to iterate it.
So suppose I have a file thus
1234567890
1234567890
1234567899
first I need to assign two lines, by their... (3 Replies)
Discussion started by: viored
3 Replies
LEARN ABOUT DEBIAN
perl::critic::policy::variables::prohibitpunctuationvars
Perl::Critic::Policy::Variables::ProhibitPunctuationVarsUser)Contributed Perl DocumenPerl::Critic::Policy::Variables::ProhibitPunctuationVars(3pm)
NAME
Perl::Critic::Policy::Variables::ProhibitPunctuationVars - Write "$EVAL_ERROR" instead of "$@".
AFFILIATION
This Policy is part of the core Perl::Critic distribution.
DESCRIPTION
Perl's vocabulary of punctuation variables such as $!, $., and $^ are perhaps the leading cause of its reputation as inscrutable line
noise. The simple alternative is to use the English module to give them clear names.
$| = undef; #not ok
use English qw(-no_match_vars);
local $OUTPUT_AUTOFLUSH = undef; #ok
CONFIGURATION
The scratch variables $_ and @_ are very common and are pretty well understood, so they are exempt from this policy. The same goes for the
less-frequently-used default filehandle "_" used by stat(). All the regexp capture variables ($1, $2, ...) are exempt too. $] is exempt
because there is no English equivalent and Module::CoreList is based upon it.
You can add more exceptions to your configuration. In your perlcriticrc file, add a block like this:
[Variables::ProhibitPunctuationVars]
allow = $@ $!
The "allow" property should be a whitespace-delimited list of punctuation variables.
Other configuration options control the parsing of interpolated strings in the search for forbidden variables. They have no effect
on detecting punctuation variables outside of interpolated strings.
[Variables::ProhibitPunctuationVars]
string_mode = thorough
The option "string_mode" controls whether and how interpolated strings are searched for punctuation variables. Setting "string_mode =
thorough", the default, checks for special cases that may look like punctuation variables but aren't, for example $#foo, an array
index count; $$bar, a scalar dereference; or $::baz, a global symbol.
Setting "string_mode = disable" causes all interpolated strings to be ignored entirely.
Setting "string_mode = simple" uses a simple regular expression to find matches. In this mode, the magic variables $$, "$'", $# and $:
are ignored within interpolated strings due to the high risk of false positives. Simple mode is retained from an earlier draft of
the interpolated- strings code. Its use is only recommended as a workaround if bugs appear in thorough mode.
The "string_mode" option will go away when the parsing of interpolated strings is implemented in PPI. See "CAVEATS" below.
BUGS
Punctuation variables that confuse PPI's document parsing may not be detected correctly or at all, and may prevent detection of
subsequent ones. In particular, $" is known to cause difficulties in interpolated strings.
CAVEATS
ProhibitPunctuationVars relies exclusively on PPI to find punctuation variables in code, but does all the parsing itself for
interpolated strings. When, at some point, this functionality is transferred to PPI, ProhibitPunctuationVars will cease doing the
interpolating and the "string_mode" option will go away.
AUTHOR
Jeffrey Ryan Thalhammer <jeff@imaginative-software.com>
COPYRIGHT
Copyright (c) 2005-2011 Imaginative Software Systems. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license
can be found in the LICENSE file included with this module.
perl v5.14.2 2012-06-07 Perl::Critic::Policy::Variables::ProhibitPunctuationVars(3pm)