Yes, you are correct in what you say about the sum. Either doing that or seeing whether the return line provided from the function is the same as the one in the testcase file. I know diff works for files but maybe I can use it for smaller cases.
---------- Post updated at 03:04 AM ---------- Previous update was at 02:06 AM ----------
Okay, I'm at the point where I am trying to pass an argument(odd line) to the ./test program and it keeps saying "command not found." I am trying to get the return value and store it in a variable. If I just run ./test in the terminal and hit enter, the cursor goes to the next line and I can enter something. When I call ./test in this way inside a script, it doesn't call it like this does it? ./test 0 0 0
Hopefully not. I know some of this code is repetitive and needs cleaned up but I am just trying to figure out how to get a value back from this program. Once I do this I can compare the line I got back to the even line in the evens file. Sorry, I am kind of new to shell programming so my code may look bad.
---------- Post updated at 12:55 PM ---------- Previous update was at 03:04 AM ----------
Well, I've almost done it. I managed to pipe pipe odd lines in, send them to the program and put them into a return variable. I've compared them in terminal and I am getting what I want. All the test cases run and I get a 10/10, my only problem is the trailing command not found messages. I do not know why this is happening. It's probably something really small but I don't have enough experience to immediately see it. Any helpful hints as to why I'm getting "command not found." Is there something wrong with my if statement?
The output in terminal I get when I run check.sh is the following:
I have a file that has a list of numbers in it. Each line has a different number. I am trying to create some sort of loop within a script that will pick the numbers up on lines 1 and 2 and then put those figures into the script. It then goes through the process then loops back and reads lines 2 and... (5 Replies)
How can I exclude reading lines in a file that contains the following:
filesystem:/home/pach/liv_patches 128005120 88456640 37270758 71% /home/patches
That is, all lines that contain and begins with filesystem: should not be processed/read from a file (5 Replies)
How can i have a while loop as follows
while read inputline
do
<task>
done < name_list
and also store the values (delimited) on each line to temp variables so as to print them on screen as follows
while read inputline
do
set name | cut -d "," -f1 name_list # #i know this is not... (1 Reply)
Hi Experts,
I am tryin to read a file and while doing so i need to skip the lines which start with a hash (#) char.
I thought of using a goto command but a lot of guys on this site say its not the good way to program. Moreover I am using a ksh shell which deos not support goto command.
... (4 Replies)
Hi all,
I jut use a loop to read lines from the user and redirect it to a file.
echo "Enter the line"
while read -r LINE
do
echo $LINE >> FILE
if ;then
break
fi
done
input
app... (1 Reply)
Hi,
I am trying to extract lines from a text file given a text file containing line numbers to be extracted from the first file. How do I go about doing this? Thanks! (1 Reply)
Hello, I am new in shell scripting. I need help regarding following.
I have 4 files generated by backups daily. I have stored the names of these 4 files into one file. i.e I have 4 files names as a, b, c & d and these names have been put into one file abcd.txt.
Now I want to cat each file in... (7 Replies)
Hello Team,
I have 2 files.one contains english text and another contains Japanese. so i have to read english text and replace the text with Japanesh text in third file.
Basically, I need a help to write japanese language in text/xml file.I heard wstring does this.Not sure how do i write... (2 Replies)
hi all,
trying this using shell/bash with sed/awk/grep
I have two files, one containing one column, the other containing multiple columns (comma delimited).
file1.txt
abc12345
def12345
ghi54321
...
file2.txt
abc1,text1,texta
abc,text2,textb
def123,text3,textc
gh,text4,textd... (6 Replies)