[vox-tech] ksh question

2002-01-25 Thread Jay Strauss

Ok, a question guaranteed not to get flamed, or start a war.

I want one environmental variable to equal another (dynamically all the
time) but I can't figure it out.  That is I want the behavior of:

export PS1='$PWD'

For example, this is what I'd like to happen (though I can't get it to
work):

pete=one
repeat=$pete
echo $repeat
one
pete=two
echo $repeat
two


Thanks
Jay



_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

___
vox-tech mailing list
[EMAIL PROTECTED]
http://lists.lugod.org/mailman/listinfo/vox-tech



[vox-tech] Postgres Oracle Compatibility - serial column type

2002-01-25 Thread Eric Engelhard

Keywords: postgres, oracle, RDBMS computability issues

I'm trying to anticipate scripting computability issues for Postgres and
Oracle. I have already migrated from Perl Pg to Perl DBI, but there are
also RDBMS function issues to consider. Does anyone know whether Oracle
has a data (column) type equivalent to Postgres SERIAL, or does one have
to create a sequence and use nextval()/currval()/setval()?

--
Eric Engelhard
___
vox-tech mailing list
[EMAIL PROTECTED]
http://lists.lugod.org/mailman/listinfo/vox-tech



Re: [vox-tech] Postgres Oracle Compatibility - serial column type

2002-01-25 Thread Eric Engelhard

Jay Strauss wrote:
 
 The later,
 
 But many times one will put a trigger (on insert) on the table to
 automatically set the value

Thanks Jay, I had a feeling that this one would come back to haunt me.
I'll just define a compatible subroutine for inserts which contains
nextval() within the select statement. I'll never remember it otherwise.
:-)
--
Eric Engelhard
___
vox-tech mailing list
[EMAIL PROTECTED]
http://lists.lugod.org/mailman/listinfo/vox-tech



Re: [vox-tech] ksh question

2002-01-25 Thread nbs

On Fri, Jan 25, 2002 at 04:38:03PM -0600, Jay Strauss wrote:
 I guess its guaranteed not to get any response either :(

Sorry ;)

Only times I ever use ksh is when logging into Sun servers at work,
and I don't do any shell scripting on them.  (I really miss the
tcsh/bash features I got used to, too...)

-bill!
___
vox-tech mailing list
[EMAIL PROTECTED]
http://lists.lugod.org/mailman/listinfo/vox-tech



Re: [vox-tech] ksh question

2002-01-25 Thread Stephen M. Helms

nbs wrote:
{snip}

 Only times I ever use ksh is when logging into Sun servers at work,
 and I don't do any shell scripting on them.  (I really miss the
 tcsh/bash features I got used to, too...)

Why not just type bash, tcsh, sh, csh, etc... after you log into the Sun
server at work?
___
vox-tech mailing list
[EMAIL PROTECTED]
http://lists.lugod.org/mailman/listinfo/vox-tech



Re: [vox-tech] ksh question

2002-01-25 Thread nbs

On Fri, Jan 25, 2002 at 06:55:56AM -0800, Stephen M. Helms wrote:
 nbs wrote:
 {snip}
 
  Only times I ever use ksh is when logging into Sun servers at work,
  and I don't do any shell scripting on them.  (I really miss the
  tcsh/bash features I got used to, too...)
 
 Why not just type bash, tcsh, sh, csh, etc... after you log into the Sun
 server at work?

bash environment is borked.  (won't get into that :) )

hey, tcsh seems to work, tho! :)  at least, at first glance. :)

-bill!
___
vox-tech mailing list
[EMAIL PROTECTED]
http://lists.lugod.org/mailman/listinfo/vox-tech



Re: [vox-tech] ksh question

2002-01-25 Thread Jeff Newmiller

On Fri, 25 Jan 2002, Jay Strauss wrote:

 Ok, a question guaranteed not to get flamed, or start a war.
 
 I want one environmental variable to equal another (dynamically all the
 time) but I can't figure it out.  That is I want the behavior of:
 
 export PS1='$PWD'

This behavior is well-defined... PS1 expands to a dollar sign followed by
PWD.  What is also well-defined, but may not behave in the fashion you
seem to want, is the subsequent expansion by BASH of the contents of this
variable before display.  That is, you always have to evaluate the
contents of the variable, as well as evaluating the variable.

 For example, this is what I'd like to happen (though I can't get it to
 work):
 
 pete=one
 repeat=$pete
 echo $repeat
 one
 pete=two
 echo $repeat
 two

In bash, you can do:

  $ var=value
  $ ref=var
  $ echo ${!ref}
  value

but unfortunately, you cannot do

  $ ${!ref}=anothervalue

(see http://www.linuxdoc.org/LDP/abs/html/bash2.html#EX78)

I don't know ksh, but playing around with it I find:

  $ echo `eval 'echo $'$ref`
  value

seems to work.

Thus, the script receiving the indirect reference variable must be
constructed to handle the indirection.

You probably wouldn't want to be doing this with an suid script... you
could find yourself evaluating unfriendly shell code. :(

---
Jeff NewmillerThe .   .  Go Live...
DCN:[EMAIL PROTECTED]Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...2k
---




___
vox-tech mailing list
[EMAIL PROTECTED]
http://lists.lugod.org/mailman/listinfo/vox-tech