Skip to content

Latest commit

 

History

History
50 lines (37 loc) · 885 Bytes

process-get-workdir.md

File metadata and controls

50 lines (37 loc) · 885 Bytes

Problem

A tool needs the explicit path of the current task work directory.

Solution

Use the $PWD Bash variable or the pwd command to retrieve the task working directory path.

!!! note Make sure to escape the $ variable placeholder when the command script is enclosed in double quote characters.

Example

process foo {
  debug true
  script:
  """
  echo foo task path: \$PWD
  """ 
}

process bar {
  debug true
  script:
  '''
  echo bar task path: $PWD
  ''' 
}

workflow {
  foo()
  bar()
}

Run it

The command run the script with an empty channel:

nextflow run nextflow-io/patterns/process-get-workdir.nf

Use the following command to provide the same script some input files, that prevents the process from being executed:

nextflow run nextflow-io/patterns/process-get-workdir.nf --inputs ../data/prots/\*