Search code examples
exportheredoclsf

Troubleshooting export with heredoc


INTRODUCTION:

I have been using this construct to set the current group after opening a terminal at a compute server:

newgrp project1_group << ANYCODE
  cd ~/WORK/project1_rundir
  bsub xterm &
ANYCODE

After executing this script, new terminal is opened at a compute server, in the specified project rundir, and the primary group is set correctly. It works just fine...

PROBLEM DESCRIPTION:

Now I would like to set an environment variable at a compute server using the same construct:

export POLICYFILE=~/WORK/project1_rundir/.policyfile << ANYCODE
  cd ~/WORK/project1_rundir
  bsub xterm &
ANYCODE

It doesn't do anything, not even a terminal is opened.

Does anyone have an explanation, why does newgrp work and export not?

Is there a way to make this work (not necessarily using the heredoc)?


Solution

  • The problem is solved (even better, without heredoc)...

    The final solution is implemented as follows:

    cd ~/WORK/project1_rundir
    bsub -I -env "all, POLICYFILE=~/WORK/project1_rundir/.policyfile" xterm &