Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have just a cosmetic question.

I export some variable at my .bashrc as the following:

export LD_LIBRARY_PATH=/usr/local/matlab/bin/glnxa64:\

but I am used to indent the lines consequent to the start of the command to better viewing, like:

export LD_LIBRARY_PATH=/usr/local/matlab/bin/glnxa64:\

But if I do that, I will get an error like this:

-bash: export: `~/fastnet/install/lib:~/Documents/D3PD/EgRingerAnaTools/lib:': not a valid identifier

Is there a way to indent the lines as I want?


share|improve this question
up vote 1 down vote accepted

You can create a function like this...

setpath() {
    oldIFS=$IFS; IFS=":"
    var=$1; shift; eval "$var=\$*; export $var"
    IFS=$oldIFS; unset oldIFS

    /usr/local/matlab/bin/glnxa64  \
    "$FASTNET_INSTALL_PATH/lib"    \
    "$EGRINGERANATOOLS/lib"        \
    "$LD_LIBRARY_PATH"             ;

(I use this function in my ~/.profile, so it was written to be compatible with any shell that reads that file, including sh, ksh, bash, zsh... It would be shorter if written in pure Bash.)

share|improve this answer
Now I'm wondering what the hell is egringerana, which Google has exactly zero results for. – grawity Aug 15 '13 at 23:14
Hahhahah, it is a very secret project that I've failed making it secret. Just kidding, it is a project for CERN ATLAS detector for electron and photon identification. EG stands for egamma (electron and photon), RINGER is the project's name, and ANA analysis. If you search for atlas ringer cern you will find something. – Werner Oct 3 '13 at 3:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .