8

In the Shortcuts app, how do I interact with the output of a shell script? I can display the standard output, but I can't find a way to:

  • use a path as a file (e.g. show file in finder, open file, etc.)
  • loop over a list (outside the shell script, with the "Repeat with each" action

Any thoughts?

shortcuts-app

2 Answers 2

2

I'm able to use "Shell Script Result" with echo -n, e.g.

enter image description here

I needed to use the echo -n because if I just used echo then I got a ? (question mark) appended to my script's output.

1

To get a file from the output of a shell script you can use the "get file from folder" action.

This action in many cases cannot follow the path through an overlay of an APFS Volume Group. To avoid it you can choose the starting folder inside your home directory or in an ungrouped volume. Then use a relative path from it.

To get the relative path use the "replace text" action to remove the starting folder from the beginning of the string. Also remove the trailing new line.

/Volumes/ungrouped/|\n 

get file from shell script.shortcut

To repeat with each file use the "split text" action. It also removes the trailing new line. get files from shell script.shortcut

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.