Hi All,
I have a requirement where I need to compare 2 files & if the values in the files match, it should proceed, else exit the script without proceeding further.
For e.g : Scenario 1
In this case, the script should exit without proceeding further.
Scenario 2
In this case, the script should proceed further.
Scenario 3
In this case, the script should exit.
PLS NOTE : The date values in File A & B can be in any order. So, i think a diff command might not work.
Can anybody shed some light on how to accomplish this.
The following changes each comma into a newline, effectively converting the file to one that has one date per line. The lines are then sorted and the results are silently compared. cmp will not generate any output, but its exit status can be used to make the decision.
Please post the actual line from your script. Unlear where the mismatched leading backtick and trailing vertical quote in this error message came from.
Have you tried @alister's second version? This avoids very modern Shell syntax.
What Operating System and version are you running and what vintage of bash is this?
@dsfreddie
Though we note that you have changed the Shebang line from #!/bin/ksh to #!/bin/bash , please post the exact command line used to invoke the script. This is because you can quite easily override the Shebang line by invoking a script incorrectly.