I am in trouble reading a string from a file into another script as a string. Here is my detail:
I have 2 script file: one is 'step0.sh' and the other is 'step1.lsf'
'step0.sh' file contains only two lines
DIR="/sc/arion/work/kimm61/vepSIMUL/clinvar"
IN="clinvar.vcf"
and 'step1.lsf' contains those lines:
#!/bin/bash
#BSUB -J step1_1
#BSUB -P acc_Itan_lab
#BSUB -q private
#BSUB -n 41
#BSUB -R rusage[mem=20000]
#BSUB -R span[hosts=1]
#BSUB -W 120:00
#BSUB -o echo $DIR/step1out/%J.stdout
#BSUB -eo echo $DIR/step1out/%J.stderr
#BSUB -L /bin/bash
cd /sc/arion/work/kimm61/vepSIMUL/clinvar/
mkdir step1out
source activate phen
ml bcftools/1.10.2
module load vep/100
source /sc/arion/work/kimm61/vepSIMUL/clinvar/step0.sh
directory=echo "$DIR"
input=echo "$IN"
WRKDIR=echo "$DIR"/step1out
ref_fasta=/sc/arion/projects/Itan_lab/vep_data/fasta_ref/Homo_sapiens.GRCh38.dna.primary_assembly.fa.gz
myinput=echo "$DIR"/"$IN"
myoutput=vep1_1.vcf
(What I want)
- for the directory from 'step1.lsf', I would like to read 'DIR' from 'step0.sh'
- for the input from 'step1.lsf', I would like to read 'IN' from 'step0.sh'
- for the standard output(-o) and the standard err output(-eo), I would like to read'DIR' from 'step0.sh'
step1.lsf
appear to be syntactically correct POSIX variable assignments, you could simply source that file into you script. See for example exporting environment variable using .sh file – steeldriver Jul 13 '22 at 19:46