Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hello, I have a C++ program and now I have to test it using a shell script. The

ID: 3760905 • Letter: H

Question

Hello, I have a C++ program and now I have to test it using a shell script. The shell script should:

1. Display the list of letter options and their meanings when using your editor. (I believe this is just using echos)

2. Create an input file named testfile.txt, and write anything which user types from the keyboard into testfile.txt until user press ctl-d to quit typing. (this means you type out your list and whenever you type CTRL-D it puts everything into a testfile.txt)

3. Execute myEditor (the compiled C++ program) along with testfile.txt (no idea how to do this)

We just went over shell scripting, its very vague and new to me, a step by step process on how to create a shell script would be very helpful and an example of how to use the shell script.

Explanation / Answer

#!/bin/sh

echo '1. '
echo '2. '
echo '3. '
echo '4. '

touch testfile.txt

while read -r LINE ; do
echo "$LINE" >> testfile.txt
done

`./a.out testfile.txt`

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote