Bash script missing matches to conditionals
I call it "badcommentcheck." It uses Exiftool to find and remove what I consider unnecessary strings in the JPEG comment header of files of that type. As it is now, it neither alerts the user when it finds them nor removes them with Exiftool silently when it does.
The code looks like this. (BTW, shellcheck missed the mistakes --if there are any -- with the 'alerts' altogether) Code:
#!/bin/bash The questions are: Where am I making it skip returning the tip-offs to stdout? Or the 'remove' command from Exiftool ('-Comment=' with a null value is equivalent to a 'delete' or -M"del {exiv2} command.) Carver |
Quote:
Code:
bash -xv badcommentcheck |
Also, the code is incomplete as the variable 'file0' is never set. So as above, please provide example files and try the debugging option offered.
|
Quote:
|
Maybe he got it confused with -n, or read the wrong thing somewhere. It's in single brackets, I'm wondering if maybe he meant to do
Code:
if [ ! "$comm1" ]; then |
Looks to me like the big problem is the lack of a space between "-S" and "-Comment"
Code:
comm1=$(exiftool -fast5 -s -S-Comment "$line") |
you might want to re-NULL your variable too while you're at it. When it gets done checking one file to the next to clean it out.
before you're checking Code:
comm1='' with the -z Code:
comm1='' Code:
if [ -z "$1" ]; then |
If statments could be changed too
Code:
compound statements |
All times are GMT -5. The time now is 08:45 PM. |