Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8752127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:10:33+00:00 2026-06-13T13:10:33+00:00

I am currently trying to make a bash testing script that will… 1) Go

  • 0

I am currently trying to make a bash testing script that will…

1) Go into many peoples folders

2) Compile their two java files

3) Run two quick tests for the the compiled results and send the output to a file to be saved in their folder

4) Take the results of those four result files, and dump them into one result file with a template at the top for me to input the results

… and I currently have most of this done. My only issue is that their program asks for a couple lines of input, for example…

Input num 1:

Input num 2:

Input num 3:

… and so on, and I am not sure how to get it to continue putting input into their program. Do I need an EOF after my hard coded input in my bash file?? Here is what I have so far…

#! /bin/bash


for i in $(find . -maxdepth 1 -type d)
do

    pwd
    pushd "$i"
    pwd

    if [ -f "First.java" ];
    then
        javac -cp . First.java
        echo easyFirst.txt | java -cp . First - > easyFirstResult
        echo hardFirst.txt | java -cp . First - > hardFirstResult
    fi

    if [ -f "Second.java" ];
    then
        javac -cp . Second.java
        echo easySecond | java -cp . Second - > easySecondResult
        echo hardSecond | java -cp . Second - > hardSecondResult
    fi


    printf "easyFirstResult\t: \hardFirstResult\t: \easySecondResult\t: \hardSecondResult\t: " > lab5grade.txt

    popd

done

P.S. Everything is working besides the multi-line input, and I have two text files with my hard coded input to test the code.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T13:10:34+00:00Added an answer on June 13, 2026 at 1:10 pm

    I see commands like

    echo easyFirst.txt | java -cp . First - > easyFirstResult
    

    apparently supplying a line of input to the java programs; but echo commands like that don’t transfer file contents, they merely copy text like “easyFirst.txt” to stdout. To pipe the contents of file easyFirst.txt into First, use a command like

    java -cp . First - < easyFirst.txt > easyFirstResult
    

    (Note, the above supposes classpath is ., class is First, and - is an unexplained command line argument to First.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently trying to make a bash script that will go into every
I'm trying to write a shell script that will make several targets into several
I'm trying to make a bash script that will talk to a java program
I'm currently trying to make a GreaseMonkey script that will allow a user to
I am trying to make a bash script which will tar all folders individually
I'm currently trying to make a program that conjugates verbs into Spanish. I've created
I am currently attempting to make a bash script that executes a Java main
I am currently trying to write a script that will loop through multiple directories.
I am currently trying to make an application that allows the user to create
I am currently trying to make a broadcast receiver which will invoke after android

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.