Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Execute selected text as python or perl' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Execute selected text as python or perl
Authored by: SOX on Mar 11, '05 01:01:48PM

You're right about the trick of using "pbpaste | perl ". I like it!

I like it! that is a better solution than using the script at the command line.

However, in bbedit you can only execute a whole file using #!>run menu item. To execute only the selected text then you need to create a unix filter like I did.

But following your suggestion one could make a simpler bbedit script as follows:
#!/usr/bin/sh
pbpaste | perl -w

and save that in the bbedit unix scripts section so it appears under the #! menu.

the difference between this and the script I provided is that to activate the the above script one has to actually put the selected text in the pasteboard (press command-C) whereas the script I provided only required the text to be selected in bbedit. It did not have to be in the pasteboard to work in bbedit.

nice suggesions.

now if someone would just write this up as a service menu item.



[ Reply to This | # ]