Howto Simplify Multiple Exports in .bash_profile


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Howto Simplify Multiple Exports in .bash_profile
# 1  
Old 03-29-2006
Howto Simplify/Factorize Multiple Exports in .bash_profile

Dear expert,

My .bash_profile contain the following lines:

Code:
# User specific environment and startup programs
export CFLAGS="-I $HOME/.libstree/include"; 
export LDFLAGS="-L $HOME/.libstree/lib";
export LD_LIBRARY_PATH=/home/ewijaya/MyBioTool/libstree-0.4.2/lib:${LD_LIBRARY_PATH}

export CFLAGS="-I $HOME/.gsl/include"; 
export LDFLAGS="-L $HOME/.gsl/lib"; 
export LD_LIBRARY_PATH=/home/ewijaya/MyBioTool/gsl-1.7/lib:${LD_LIBRARY_PATH}

export CFLAGS="-I $HOME/.swish/include"; 
export LDFLAGS="-L $HOME/.swish/lib"; 
export LD_LIBRARY_PATH=/home/ewijaya/.swish/lib:${LD_LIBRARY_PATH}

I wonder how can I simplify those multiple: CFLAGS,LDFLAGS,and LD_LIBRARY_PATH?

Second question is that, why after doing "printenv" the CFLAGS,LDFLAGS are only shown for .swish? namely the last block of export for .swish?

Code:
$ printenv | grep 'CFLAGS'

Gives only:
CFLAGS=-I /home/ewijaya/.swish/include

and

Code:
$ printenv | grep 'LDFLAGS'

Gives only:
LDFLAGS=-L /home/ewijaya/.swish/lib

But it's okay for LD_LIBRARY_PATH:
Code:
$ printenv | grep 'LD_LIBRARY'
LD_LIBRARY_PATH=/home/ewijaya/.swish/lib:/home/ewijaya/MyBioTool/gsl-1.7/lib:/home/ewijaya/MyBioTool/libstree-0.4.2/lib:

Thanks so much beforehand.

Last edited by monkfan; 03-29-2006 at 02:29 PM..
# 2  
Old 03-30-2006
Look more carefully at what you've written Smilie

export CFLAGS="-I $HOME/.swish/include"; overwrites
export CFLAGS="-I $HOME/.gsl/include"; which overwrites
export CFLAGS="-I $HOME/.libstree/include";

and the LDFLAGS code is similar

LD_LIBRARY_PATH is different, each time you set it you are including its previous value, extending it rather than overwriting it:

export LD_LIBRARY_PATH=/home/ewijaya/MyBioTool/libstree-0.4.2/lib:${LD_LIBRARY_PATH}

To simplify, try something like:
export CFLAGS="-I $HOME/.swish/include:$HOME/.gsl/include:$HOME/.libstree/include";

hope this helps
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

NFS not showing under /etc/fstab nor /etc/exports

Hi guys, I was asked to perform the following: On server usdfslpsap04 following NFS mounts should be disabled usdfslpwmt3:/u01/opt/wm6_data/ebiz_edi/CALIBER_data 50412232 13369544 34481872 28% /u01/opt/wm6_data/ebiz_edi/CALIBER_data usauxoradw:/DWH/Transfer/current... (1 Reply)
Discussion started by: 300zxmuro
1 Replies

2. SCO

Problem with nfs exports between 5.0.5 and 5.0.7

Hello everyone! I have two systems: an old SCO 5.0.5 Openserver (here's the uname -a output): /# uname -a SCO_SV munixela 3.2 5.0.5 i386 And a SCO 5.0.7 OpenServer (uname -a output): /# uname -a SCO_SV catedral 3.2 5.0.7 i386 I exported a Filesystem from the 5.0.7 machine, using the... (13 Replies)
Discussion started by: superchivo
13 Replies

3. Shell Programming and Scripting

Can I simplify this script?

Hi all, I have a script which runs every morning which clears down a series of directories. The structures of which are; /opt/feeds/failed/feed1 /opt/feeds/succeed/feed1 /opt/feeds/failed/feed2 /opt/feeds/succeed/feed2 /opt/feeds/failed/feed3 /opt/feeds/succeed/feed3 etc etc Files... (6 Replies)
Discussion started by: JayC89
6 Replies

4. AIX

AIX Exports file

Why can I not add more than 1 filesystem to the /etc/exports file and export them via smitty, or command line? I have tried, I stopped the NFS daemons, edited the /etc/exports file by hand, saved it, then re-started NFS, but it only still exports the first line in the exports file. ... (4 Replies)
Discussion started by: mrmurdock
4 Replies

5. Programming

Listing function exports from object file

Is it possible to view all the functions exported by a given object file? "dump -tv" comes the closest, but what exactly am I looking for to determine whether the symbol exists in the object file? Essentially, I have a library that requires a call to "xdr_sizeof" and the compile is failing... (5 Replies)
Discussion started by: DreamWarrior
5 Replies

6. Shell Programming and Scripting

How can I simplify the script

Hi all, How can I simplify following script, Logic is to find two strings (strings are case sensitive) from a file. if ; then if ; then Group=`echo $1_hostname` fi fi Please help me on this. Regards Sudhish s. kumar (8 Replies)
Discussion started by: sudhish
8 Replies

7. UNIX for Dummies Questions & Answers

Howto Simplify/Factorize Exports in .bash_profile

Dear expert, My .bash_profile contain the following lines: # User specific environment and startup programs export CFLAGS="-I $HOME/.libstree/include"; export LDFLAGS="-L $HOME/.libstree/lib"; export LD_LIBRARY_PATH=/home/ewijaya/MyBioTool/libstree-0.4.2/lib:${LD_LIBRARY_PATH} export... (1 Reply)
Discussion started by: monkfan
1 Replies

8. Programming

Howto spawn multiple child processes and wait?

As far as I can tell, the bash wait command waits for a logical "AND" of all the child processes. Assuming I am coding in C: (1) What is the function I would use to create multiple bash child process running perl? (2) What is the function I would use to reinvent the bash wait command so I... (4 Replies)
Discussion started by: siegfried
4 Replies

9. UNIX for Advanced & Expert Users

nfs exports and netmask option

Setting up nfs on a redhat ES 4 gives me following issue that i can't explain. My nfs was working perfect whith following /etc/exports on the server /home/test/nfstest 198.9.200.227(rw,sync,no_root_squash) But after a powerloss and restart of the server it only works with the... (0 Replies)
Discussion started by: progressdll
0 Replies

10. UNIX for Dummies Questions & Answers

/etc/exports

i have the following entry in /etc/exports which is /opt/hpxt. i am on hpux b11.0.0 questions 1) is /hpxt in the same physical machine? got confused by the meaning of export. (1 Reply)
Discussion started by: yls177
1 Replies
Login or Register to Ask a Question