Bash Parameter expansion #2319
Answered
by
abhi18av
Jbrenton191
asked this question in
Q&A
-
Bug reportI found a work around using either rename or basename functions but just wanted to highlight. Expected behavior and actual behaviorExpected behaviour: Typical bash parameter expansion: ie: ~/nextflow_pd$ gtf_file=Homo_sapiens.GRCh38.97.gtf
~/nextflow_pd$ echo ${gtf_file%.gtf}
Homo_sapiens.GRCh38.97 Actual behaviour: Script compilation error
1 error Steps to reproduce the problem-ran the following process with command: nextflow run test_bug.nf nextflow.enable.dsl=2
process gtf_to_bed {
echo true
input:
path(gtf_file)
output:
path("*.bed")
script:
"""
echo $gtf_file > ${gtf_file%.gtf}.bed
"""
}
workflow {
gtf_file=file("$projectDir/Homo_sapiens.GRCh38.97.gtf")
gtf_to_bed(gtf_file)
} Program output`Script compilation error
1 error ` Environment
Additional contextRunning on a linux server |
Beta Was this translation helpful? Give feedback.
Answered by
abhi18av
Sep 15, 2021
Replies: 1 comment 5 replies
-
Hi @Jbrenton191 , The usage of
Please either
|
Beta Was this translation helpful? Give feedback.
5 replies
Answer selected by
Jbrenton191
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @Jbrenton191 ,
The usage of
$
in thescript
section is the issue.Please either
echo \$gtf_file ...
shell
directive which doesn't need these characters to be escaped https://www.nextflow.io/docs/latest/process.html#shell