Re: bash root ~/.bash_profile quirk

2007-09-06 Thread Chris F.A. Johnson
On 2007-09-06, asherwolf wrote:
>
> I have the following in my root ~/.bash_profile:
>
> PATH=$PATH:$HOME/bin
> LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/local/BerkeleyDB.4.6/lib:/usr/local/apr/lib:/usr/lib/httpd/modules
> LD_RUN_PATH=$LD_RUN_PATH:/usr/local/lib:/usr/local/BerkeleyDB.4.6/lib:/usr/local/apr/lib:/usr/lib/httpd/modules
> PKG_CONFIG_PATH=$PKG_CONFIG:/usr/local/lib/pkgconfig:/usr/X11R6/lib/pkgconfig
>
> export PATH
> export LD_LIBRARY_PATH
> export LD_RUN_PATH
> export PKG_CONFIG_PATH
>
> BUT
>
> When I use su to log into root, PATH is there, LD_RUN_PATH is there, and
> PKG_CONFIG_PATH is there, but not LD_LIBRARY_PATH (which makes some of my
> programs not cooperate)

   Are you using "su" or "su -"?

-- 
   Chris F.A. Johnson  
   ===
   Author:
   Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)




Re: bash root ~/.bash_profile quirk

2007-09-06 Thread Andreas Schwab
asherwolf <[EMAIL PROTECTED]> writes:

> When I use su to log into root, PATH is there, LD_RUN_PATH is there, and
> PKG_CONFIG_PATH is there, but not LD_LIBRARY_PATH (which makes some of my
> programs not cooperate)
>
> Is there something I'm missing?  Why would an environment variable not show
> up?

A setuid binary ignores LD_LIBRARY_PATH for security reasons.

Andreas.

-- 
Andreas Schwab, SuSE Labs, [EMAIL PROTECTED]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Re: script using file dates

2007-09-06 Thread Bob Proulx
marquis wrote:
> > I'm looking for an exisiting script, or a command to help w/
> > processing files by date.  I have a test website and need to
> > upload only the files that have been changed since the last
> > upload.  I'm thinking of creating a file list and the date of the
> > last upload.  if the modified date is after the date in this file,
> > it would upload.  Has anyone seen a script to do this?  i found
> > "test -nt" and "test -ot" but this is to compare two file dates,
> > not a file to a stored date.  ideas?  thanks
> 
> TMP=`ls -Aa` ; for x in $TMP ; do echo -n "$x - " ; stat $x | tac | head -1 ;
> echo "" ; done

Hmm...  I hate to sound too critical here but I can't restrain making
comments about that command line.  It is working very much too hard to
perform the function of listing out a directory with the inode change
timestamps listed.  (And also that is not sufficient to solve the
original poster's question either.)  But back to that command line...

> TMP=`ls -Aa`

The ls -a option overrides the -A option.  Therefore 'ls -Aa' is the
same as 'ls -a'.  But you probably wanted 'ls -A' there.

> for x in $TMP ; do

Of course files with whitespace in them cause trouble here.  An extra
splitting is introduced here that will split files with whitespace
apart.

> echo -n "$x - "

Use of 'echo' with options is a portability nightmare.  Better to use
'printf' in that case.

> stat $x | tac | head -1

This is functionally the same as asking stat to output only the time
of last change directly.

  stat --format %z $x

> echo "" 

why the extra blank line?

Overall this is almost the same as using 'ls' directly.

  ls -Aclog

Bob




Re: bash root ~/.bash_profile quirk

2007-09-06 Thread asherwolf


Andreas Schwab wrote:
> 
> 
>>A setuid binary ignores LD_LIBRARY_PATH for security reasons.
> 
> 

Oh... I didn't know that, but now I do!  Thanks!

Asher
-- 
View this message in context: 
http://www.nabble.com/bash-root-%7E-.bash_profile-quirk-tf4389588.html#a12533627
Sent from the Gnu - Bash mailing list archive at Nabble.com.





Re: bash root ~/.bash_profile quirk

2007-09-06 Thread asherwolf



On 2007-09-06, asherwolf wrote:
>
> I have the following in my root ~/.bash_profile:
>
> PATH=$PATH:$HOME/bin
> .
> PKG_CONFIG_PATH is there, but not LD_LIBRARY_PATH (which makes some of my
> programs not cooperate)

>>Are you using "su" or "su -"?

I'm using just su... should I use "su -" ?

Asherwolf

-- 
View this message in context: 
http://www.nabble.com/bash-root-%7E-.bash_profile-quirk-tf4389588.html#a12533621
Sent from the Gnu - Bash mailing list archive at Nabble.com.





Re: bash root ~/.bash_profile quirk

2007-09-06 Thread Chris F.A. Johnson
On 2007-09-06, asherwolf wrote:
>
> On 2007-09-06, asherwolf wrote:
>>
>> I have the following in my root ~/.bash_profile:
>>
>> PATH=$PATH:$HOME/bin
>> .
>> PKG_CONFIG_PATH is there, but not LD_LIBRARY_PATH (which makes some of my
>> programs not cooperate)
>
>>>Are you using "su" or "su -"?
>
> I'm using just su... should I use "su -" ?

   If you use "su -", it does the equivalent of logging in, and thus
   reads .bash_profile; "su" by itself doesn't.

-- 
   Chris F.A. Johnson  
   ===
   Author:
   Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
.