So I’m using the terminal and I issue the command
clear | java email11
And I get this crazy execution of half the code I wrote
“Enter input filename [default: fileContainingEmails.txt]: Enter
output filename [default: ]:”
then an error:
Enter input filename [default: fileContainingEmails.txt]: Enter output filename [default:
]: Exception in thread "main" java.util.NoSuchElementException: No line found
at java.util.Scanner.nextLine(Scanner.java:1516)
at email11.main(email11.java:39)
all together like:
myMachine:mydir me$ clear | java email11
Enter input filename [default: fileContainingEmails.txt]: Enter output filename [default:
]: Exception in thread "main" java.util.NoSuchElementException: No line found
at java.util.Scanner.nextLine(Scanner.java:1516)
at email11.main(email11.java:39)
and the termainal goes back to:
myMachine:mydir me$
So my question is, how do I pipe this command successfully?
Try
which gives you something like
This is the input to your email11 program. Probably not your intention.
Just do:
That simply runs the two commands, one after the other, as if you had typed them on two separate lines.
You should probably read the documentation for the command shell you’re using. The default shell on OSX is bash; you can see the manual here.