Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

request: exists(File | Directory) STDLIB function #692

Open
a-frantz opened this issue Nov 25, 2024 · 1 comment
Open

request: exists(File | Directory) STDLIB function #692

a-frantz opened this issue Nov 25, 2024 · 1 comment

Comments

@a-frantz
Copy link

I want to do something like this:

    output {
        Array[String] labels = if exists("labels.txt") then read_lines("labels.txt") else []
    }

but am currently writing an ugly workaround to achieve the same logic.

@rhpvorderman
Copy link
Contributor

command <<<
my_commad

if [ ! -f "labels.txt" ] 
then touch labels.txt  # Labels.txt will be empty.
fi

>>>
output
Array[String] labels = read_lines("labels.txt")

Alternatively if the existance of the file is dependent on the inputs you could use those rather than checking for the existence of the file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants