Re: Looking for command to compare two strings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/2/06, Andy Green <andy@xxxxxxxxxxx> wrote:
> Is there some command to automatically check whether the two following
> strings are equal?
>
> e64829764ecc434be937d92ab3a00f57
> e64829764ecc434bg937d92ab3a00f57

[b]ash can do it easily enough, eg save this as say isequal

#!/bin/sh

if [ "$1" = "$2" ] ; then echo "same" ; else echo "different" ; fi


make sure you

chmod +x isequal

then you can go, eg

./isequal e64829764ecc434be937d92ab3a00f57 e64829764ecc434bg937d92ab3a00f57

You can use the guts of the script from the commandline, even better

if [ "`md5sum $1`" = "`md5sum $2`" ] ; then echo "same" ; else echo
"different" ; fi

Thanks, Andy. Is not there a native Linux command to compare strings?

Paul

--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux