You need a lot more than an if statement to do what you want to do. And, if you want our help we will need a lot more information:
What operating system are you using?
What shell are you using?
What are the formats of files FileA and FileB?
Can you show us a representative sample of the contents of FileA and FileB and show us the results you hope to get when processing those two sample files?
And, most importantly, please show us what you have tried to solve this problem on your own.
$SHELL -version
GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
Formats and Code:
Code:
Package: [package name]
Priority: extra
Section: --
Installed-Size: 12787
Maintainer: [Creator of the package]
Architecture: amd64
Source: [Source of the Package]
Version: [Version]
Depends: [Depends]
Filename: [Filename and directory of the file]
Size: [Filesize]
MD5sum: [checksum]
SHA1: [checksum]
SHA256: [checksum]
Description [description]
Homepage: [homepage]
Quote:
Originally Posted by Chubler_XL
Assuming you already have the two file locally (you will need to fetch FileA from the web server using something like wget).
Also that the SHA keys are a string of 64 hex digits (0-9 a-f) which are separated from other text in file by one or more white space characters.
Hi, thank you for this - I went ahead and tested this and it seems to work fine, I then modifed it to this format:
Code:
echo "The following keys were not found on the apt-mirror:" && grep -vf <(curl [repo-file] | grep ‘SHA256') <(cat [address-of-local-repo-file] | grep ‘SHA256') || echo "Files Match"
and this also seems to work.
So lets say I wanted to take a step further and wanted to also retrieve the program name and version of the repo's from 'ListA' that do not appear on ListB given that they are included in the list I mentioned above?
Hi
How can i compare a string using if statement in a script?
For eg:
I have
filename="abc.sh"
if ;then
{
.......
.......
}
fi
but this doesnot work .. How will i execute this ??
Thanks in advance (1 Reply)
I am writing a script that ssh's out to our various servers and extracts diskspace info to generate into a report. With the mix of servers linux/solairs 8-10/AIX the easiest way is to use df -k (though I much rather prefer df -h).
I have pasted the relevant code:
dfdata=`ssh -q -o... (1 Reply)
Here is my situation. I need to compare two tab separated files (diff is not useful since there could be known difference between files).
I have found similar posts , but not fully matching.I was thinking of writing a shell script using cut and grep and while loop but after going thru posts it... (2 Replies)
I have the following simplified code that I am planning on putting into a larger shell script. I have been butchering it to try and make work amongst google searches and reading awk documentation.
amixer sset Master toggle | awk '{ if ( /^ Front Left/ { print $7 } == // ) print "MUTED" }'I... (2 Replies)
I'm just interested to know how your sources.list look like. I got some repositories witch give some errors and I would like to clean it up.
and when I do apt-get update I get few lines showing errors like 404 , this is how my list look like:
# deb cdrom:/ squeeze main
# deb cdrom:/... (0 Replies)
Hi,
Is it possible to convert MD5 passwords to SHA-512?
I'm about to migrate an old slackware server to Debian, then I noticed that they don't use same encryption method.
I'm aware that I can change the encryption method in Debian to MD5, but as far as I understand SHA-512 is more secure,... (2 Replies)
Hello Guys,
I was trying to have an SHA256 encryption which further be encrypted into base 64 using AIX unix command shasum -a 256.
What I found in this is my output is different than a website: "online-convertcom"
Actually conversion from website is exactly matching my requirements but... (4 Replies)
Hi,
I am trying to do the following to see if "ip" is already present in a file.
if ; then
echo "hi"
else
echo "hello"
fi
I am seeing errors on the if statement. Can someone please correct the syntax for me? Thanks (2 Replies)