Message Boards Message Boards

0
|
2840 Views
|
0 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Pass the contents of pbpaste into a script

Posted 4 years ago

I am just starting to experiment with Wolfram Script. I have the following script:

#!/usr/bin/env wolframscript -function -args
Function[StringReplace[#, "\n" -> ", "]]

./print.wls "hello 
 world"

Produces "hello, world" so the function works as expected. I now want to run it where the input comes directly from the text added to the clipboard.

I tried

pbpaste | ./print.wls 

But the WLS throws an error

Function::slotn: Slot number 1 in StringReplace[#1,  -> , ] &  cannot be filled from (StringReplace[#1,  -> , ] & )[].

Can someone enlighten me as to the correct approach?

Cheers Andy

POSTED BY: Andrew Burnett
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract