tschloss
tschloss

Reputation: 367

Automator: "run shell script" action only receives 1st line of input

I have a weird looking problem (a similar one was asked here, but I don't want to accept that Automator only pipes only 1 line into the shell script action!: Mac Automator: shell script gets only one line)

Automator-Workflow, type "service", 3 blocks:

  1. Service receives "Text"
  2. "run shell script", "bash", input via "stdin", shell script: "cat"
  3. copy to clipboard"

When I select a multiline text and run this service only the first line finishes in the clipboard.

I made three other tests:

  1. skip the shell script action - directly move the selection into the clipboard >> works!
  2. instead of taking the input from the text selection the shell script action gets the input via an "read from clipboard" action from the clipboard >> fails (first line only)
  3. instead of the "bash" action I selected a "perl" action >> fails (first line only)

So it seems obvious that the run shell script action contains the problem. But I have used the shell script action (with web-content) many times before with no problems.

Any ideas? Maybe a problem with encoding and or line-endings?

Upvotes: 2

Views: 3518

Answers (2)

0_LuckyOne_0
0_LuckyOne_0

Reputation: 11

I ran into the same issue. Instead of using the 'copy to clipboard' command I then tried executing another shell script (setting its input to 'stdin') containing only the command 'pbcopy'. Afterwards line breaks were preserved properly.

Upvotes: 1

clt60
clt60

Reputation: 63892

At least on my Mac, when

  • start Automator
  • Choose Type -> Service

enter image description here

save at some name (mine is TestService), then

  • go to TextEdit
  • enter some text
  • select

enter image description here

  • from the TextEdit's menu: TextEdit -> Services -> TestService

enter image description here

Got to the clipboard the next:

2 ééééééééééé
3 íííííííííí
4 αβγδεζη
5 ЧШЩЪЫЬЭ
6 aaaaaaaaaa

Try exactly the above... ;)

Upvotes: 1

Related Questions