0

This doesn't seem to be working correctly.
$4 is a C file. $in is the input file. $5 is a newly created output file, after $in inputs to $4 (I'm not really sure about this one.)

$out is an output that I created before running the script.

After, I'm comparing $5 and $out to see if they are equal.

I'm just wondering what does the ; mean.

    $4 < $in > $5
    if  diff $5 $out  >/dev/null 2>&1 ;  
    then
       echo "same!"
    else
       echo "different!"
    fi  

(This is in Bourne Shell)

7
  • Seriously? All that and what you're asking is what ; does in sh? Commented Nov 27, 2012 at 4:00
  • I'm also asking about the $5 part. lol. I'll try to make that into a question. Commented Nov 27, 2012 at 4:03
  • I want the output of "$4 < $in" to be compared with $out. Commented Nov 27, 2012 at 4:05
  • lol ok. How do I compare the output of $4 < $in" to $out ? (I don't think I need $5.) Commented Nov 27, 2012 at 4:08
  • Will we regret it if we ask what $1, $2 and $3 represent? What exactly are you trying to do? Please explain at a high level. (For example, "I'm trying to compare the old and new versions of a C source file after compiling them to ensure they're both sound", except that only seems to require two arguments and not $in or $out too.) Commented Nov 27, 2012 at 4:14

1 Answer 1

1

The semi-colon is redundant, but marks the end of the diff command. It could have been followed by another command, but isn't.

[I've removed some comments based on a misunderstanding of what a 'C file' is. In this context, it means a 'program written in C' rather than a C source file.]

Sign up to request clarification or add additional context in comments.

2 Comments

oh sorry, about the confusion.
I think I found my problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.