Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADD EXAMPLE] Shell one-liner #31

Open
jeremydouglass opened this issue Dec 20, 2019 · 1 comment
Open

[ADD EXAMPLE] Shell one-liner #31

jeremydouglass opened this issue Dec 20, 2019 · 1 comment
Labels
add_example add an example sketch to the set

Comments

@jeremydouglass
Copy link
Owner

https://rosettacode.org/wiki/Shell_one-liner#Processing

The shell one-liner sketch is actually a bash shell script designed for the processing-java command line tool, so it cannot be implemented as a PDE sketch. It could perhaps be added as a shell script in a folder, although it would not appear in the PDE Examples menu.

The command-line tool processing-java takes a sketch directory (not a file) and so a simple program cannot be piped in from the shell using process substitution. However, a long shell one-liner may write a sketch file to disk, then run it, so long as the folder name and the PDE file name match, e.g. /Tmp/Tmp.pde

In bash:

mkdir -p Tmp; echo "println(\"hello world\");" > Tmp/Tmp.pde; processing-java --sketch="`pwd`/Tmp" --run

Output:

hello world

@jeremydouglass jeremydouglass added the add_example add an example sketch to the set label Dec 20, 2019
@jeremydouglass
Copy link
Owner Author

An alternate (or additional) way to approach this would be to demonstrate how a shell one-liner is invoked from within a processing sketch, e.g. wth launch() / exec() https://processing.org/reference/launch_.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
add_example add an example sketch to the set
Projects
None yet
Development

No branches or pull requests

1 participant