Re: sqlplus variable

  • From: "Jared Still" <jkstill@xxxxxxxxx>
  • To: Brian.Zelli@xxxxxxxxxxxxxxx
  • Date: Mon, 30 Oct 2006 10:34:31 -0700

For some reason there is a carriage return (\r) embedded in the variable.

If you are setting this in .bash_profile, try retyping the line and deleting
the old one.


On 10/30/06, Zelli, Brian <Brian.Zelli@xxxxxxxxxxxxxxx> wrote:

Hello all, I strange thing happens when I set a variable in Linux. I set the variable as SQL_UTL='sqlplus /nolog' in the bash shell. When I do a set command to see all the variables, it looks like this:

SQL_UTL=$'sqlplus /nolog\r'
For those on Linux, how do I correct this?  It works fine on my HP UX
boxes.

ciao,
Brian


------------------------------ *From:* Wolfson Larry - lwolfs [mailto:lawrence.wolfson@xxxxxxxxxx] *Sent:* Monday, October 23, 2006 4:27 PM *To:* Wolfson Larry - lwolfs; Zelli, Brian; oracle-l *Subject:* RE: sqlplus variable

 You might just want to try google first like bash export variable
definition     Larry Example: 3.2.2. Creating variables

Variables are case sensitive and capitalized by default. Giving local
variables a lowercase name is a convention which is sometimes applied.
However, you are free to use the names you want or to mix cases. Variables
can also contain digits, but a name starting with a digit is not allowed:

prompt> *export 1number=1*
bash: export: `1number=1': not a valid identifier

To set a variable in the shell, use

*VARNAME="value"*

Putting spaces around the equal sign will cause errors. It is a good habit
to quote content strings when assigning values to variables: this will
reduce the chance that you make errors.

Some examples using upper and lower cases, numbers and spaces:

franky ~> *MYVAR1="2"*


------------------------------ *From:* oracle-l-bounce@xxxxxxxxxxxxx [mailto: oracle-l-bounce@xxxxxxxxxxxxx] *On Behalf Of *Wolfson Larry - lwolfs *Sent:* Monday, October 23, 2006 3:11 PM *To:* Brian.Zelli@xxxxxxxxxxxxxxx; oracle-l *Subject:* RE: sqlplus variable

 Not a "bash" guy but maybe you just need to put this on separate lines or
use a ";" (semicolon) in between
or like ksh
say
export SQL_UTILITY='sqlplus /nolog'

 ------------------------------
*From:* oracle-l-bounce@xxxxxxxxxxxxx [mailto:
oracle-l-bounce@xxxxxxxxxxxxx] *On Behalf Of *Zelli, Brian
*Sent:* Monday, October 23, 2006 3:01 PM
*To:* oracle-l
*Subject:* sqlplus variable

 Hello all,

I've been trying to script a backup that uses sqlplus /nolog as a
variable.  I create the variable as:
SQL_UTILITY='sqlplus /nolog' export SQL_UTILITY

in my bash script but when I execute it I get:


': not a valid identifier

I've tried a bunch of different combos but still get the same error.
Which part is wrong?

If I just type this at the command line and then echo back $SQL_UTILITY,
it works.  What could be wrong script-wise?
ciao,
Brian


************************************************************************* The information contained in this communication is confidential, is intended only for the use of the recipient named above, and may be legally privileged.

If the reader of this message is not the intended recipient, you are
hereby notified that any dissemination, distribution or copying of this
communication is strictly prohibited.

If you have received this communication in error, please resend this
communication to the sender and delete the original message or any copy
of it from your computer system.

Thank you.
*************************************************************************


This email message may contain legally privileged and/or confidential information. If you are not the intended recipient(s), or the employee or agent responsible for the delivery of this message to the intended recipient(s), you are hereby notified that any disclosure, copying, distribution, or use of this email message is prohibited. If you have received this message in error, please notify the sender immediately by e-mail and delete this email message from your computer. Thank you.




-- Jared Still Certifiable Oracle DBA and Part Time Perl Evangelist

Other related posts: