Re: [opensuse] bashrc variables

2007-04-25 Thread Randall R Schulz
On Wednesday 25 April 2007 00:03, Vince Oliver wrote:
 Hi All,

 I can not find any documentation on what is the difference when I
 define some variable in .bashrc file like for example:

 COS_PATH=+$COSSPEC2D_DIR/pro:$COS_PATH

 and

 COS_PATH=$COSSPEC2D_DIR/pro:$COS_PATH

 (ie without +). Could somebody tell me?

The plus is not special. If present, it becomes part of the variable's 
value.


 Also I am not sure when to export variables.  Should I export it at
 the end of .bashrc file or whenever the variable is changed? Or
 perhaps once to export wherever in the file and not to warry about
 changes in later?

Exporting is completely independent of setting. All three of these 
techniques yield the same result:

# A:
ENV_VAR=value
export ENV_VAR

# B:
export ENV_VAR
ENV_VAR=value

# C:
export ENV_VAR=value


I prefer the third form (C). The first (A) is the most classic. Some 
people think it odd to declare a variable exported before it's actually 
set (B).


 thank you
 oliver


Randall Schulz
-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: [opensuse] bashrc

2007-04-24 Thread Morten Bjørnsvik
|From: Vince Oliver [mailto:[EMAIL PROTECTED] 
|I would like to set some aliases in .bashrc that shall do some 
|usefull things like:
|
|alias al=echo $PATH | awk 'BEGIN{FS=:} {for(i=1;i=NF;i++) 
|print $i}'
|
|
|This alias in not executed.  How to define such aliases?
|
You need execution quotes, and it is a bad idea to use
the same quotes inside as you use to terminate entire string

alias al=`echo $PATH | awk 'BEGIN{FS=:} {for(i=1;i=NF;i++) print $i}'`

--
MortenB
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [opensuse] bashrc

2007-04-24 Thread Rolf Masfelder
Am Dienstag, 24. April 2007 09:24 schrieb Vince Oliver:
 Hi all

 I would like to set some aliases in .bashrc that shall do some
 usefull things like:

 alias al=echo $PATH | awk 'BEGIN{FS=:} {for(i=1;i=NF;i++) print
 $i}'

this is usefull? 


 This alias in not executed.  How to define such aliases?
use `backticks` (I hope you see them ;-) ... `echo ...`



 thanks
 oliver
good luck

Rolf
-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [opensuse] bashrc

2007-04-24 Thread Jos van Kan
Op di april 24 2007 11:33, schreef Rolf Masfelder:
 Am Dienstag, 24. April 2007 09:24 schrieb Vince Oliver:
  Hi all
 
  I would like to set some aliases in .bashrc that shall do some
  usefull things like:
 
  alias al=echo $PATH | awk 'BEGIN{FS=:} {for(i=1;i=NF;i++) print
  $i}'

 this is usefull?

  This alias in not executed.  How to define such aliases?

 use `backticks` (I hope you see them ;-) ... `echo ...`

Better still, use $(...) instead of backticks `...`. Precisely for the reason 
Rolf states.
-- 
Jos van Kan   registered Linux user #152704
-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [opensuse] bashrc

2007-04-24 Thread Randall R Schulz
On Tuesday 24 April 2007 00:24, Vince Oliver wrote:
 Hi all

 I would like to set some aliases in .bashrc that shall do some
 usefull things like:

 alias al=echo $PATH | awk 'BEGIN{FS=:} {for(i=1;i=NF;i++) print
 $i}'

I use this:

path() {
echo $PATH |tr ':' '\n'
}

I have similar functions for my cd-path ($CDPATH), my Java class-path 
($CLASSPATH), my directory stack (not quite as simple as the others) 
and other path-like environment variables.

I hate to see that stuff smashed together on one line.


 ...

 thanks
 oliver


Randall Schulz
-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]