hello, i'm trying to run a shell and it seems that...
# ask-community
d
hello, i'm trying to run a shell and it seems that it only outputs one line when i perform 'ls -lat' is that an expected behavior? (I've taken bits and pieces from here : https://github.com/PrefectHQ/prefect/issues/1013
Copy code
from prefect import Flow, task
from prefect.tasks.shell import ShellTask

my_task = ShellTask(helper_script="cd /etc")

@task
def print_output(output):
  print(output)

with Flow("My shell") as flow:
  result = my_task(command='ls -lat')
  print_output(result)

if __name__ == '__main__':
    out = flow.run()
c
Yup that is expected; shell tasks only return the last line by default but that can be configured as described here: https://docs.prefect.io/api/unreleased/tasks/shell.html#shelltask
👍 1
d
perfect !