Skip to content

Commit

Permalink
fix: Escape '$' for cmd interpolation
Browse files Browse the repository at this point in the history
  • Loading branch information
shihabdider committed Oct 18, 2023
1 parent e18903d commit 5c20423
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
7 changes: 4 additions & 3 deletions modules/local/dryclean/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ process DRYCLEAN {
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
"""
#!/bin/bash
set -o allexport
# Check if the environment has the module program installed
if command -v module &> /dev/null
Expand All @@ -59,12 +60,12 @@ process DRYCLEAN {
set +x
## find R installation and dryclean exec
echo "USING LIBRARIES: $(Rscript -e 'print(.libPaths())')"
export drycleanPath=$(Rscript -e 'cat(suppressWarnings(find.package("dryclean")))')
echo "USING LIBRARIES: \$(Rscript -e 'print(.libPaths())')"
export drycleanPath=\$(Rscript -e 'cat(suppressWarnings(find.package("dryclean")))')
export drycln=$drycleanPath/extdata/drcln
echo $drycln
set +x
CMD="Rscript $drycln $@"
CMD="Rscript $drycln \$@"
if [ ! -s ./drycleaned.cov.rds ]; then
if ! { echo "Running:" && echo "${CMD}" && eval ${CMD}; }; then
Expand Down
14 changes: 8 additions & 6 deletions modules/local/jabba/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ process JABBA {
// e.g. https://github.com/nf-core/modules/blob/master/modules/nf-core/homer/annotatepeaks/main.nf
// Each software used MUST provide the software name and version number in the YAML version file (versions.yml)
"""
#!/bin/bash
set -o allexport
# Check if the environment has the module program installed
Expand All @@ -86,17 +88,17 @@ process JABBA {
R_PROFILE_USER="/dev/null"
## find R installation
echo "USING LIBRARIES: $(Rscript -e 'print(.libPaths())')"
echo "USING LIBRARIES: \$(Rscript -e 'print(.libPaths())')"
export jabPath=$(Rscript -e 'cat(suppressWarnings(find.package("JaBbA")))')
export jabPath=\$(Rscript -e 'cat(suppressWarnings(find.package("JaBbA")))')
export jba=$jabPath/extdata/jba
echo $jba
set +x
export cmd="Rscript $jba $@"
export cmd="Rscript $jba \$@"
{ echo "Running:" && echo "$(echo $cmd)" && echo && eval $cmd; }
cmdsig=$?
{ echo "Running:" && echo "\$(echo $cmd)" && echo && eval $cmd; }
cmdsig=\$?
if [ "$cmdsig" = 0 ]; then
echo "Finish!"
else
Expand All @@ -110,7 +112,7 @@ process JABBA {
stub:
prefix = task.ext.prefix ?: "${meta.id}"
def VERSION = '1.1' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions.

"""
touch jabba.simple.rds
touch jabba.simple.gg.rds
Expand Down

0 comments on commit 5c20423

Please sign in to comment.