Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 12-28-2006, 11:55 AM   #1
LQ Newbie
Registered: Nov 2005
Posts: 1

Rep: Reputation: 0
Question Linux Scripting

I am trying to write script to compare 2 values. Here is what have so far if any can see an errors in it.
R1.txt - txt file with numbers in it
R2.txt - txt file with numbers in it

cmp R1.txt R2.txt
if (( $? != 0 )); then
echo "cmp says files file are identical"
echo "cmp says files files are different"


R1=variable numbers that changes
R2=variable numbers that changes

if ($R1 = $R2) then
echo "cmp says files file are identical"
echo "cmp says files files are different"

I am not sure which way I should go or if the syntax is correct.
Old 12-28-2006, 01:54 PM   #2
Registered: Dec 2002
Location: Los Angeles
Distribution: Debian
Posts: 72

Rep: Reputation: 15
Instead of ( ) (parenthesis) use [ ](brackets)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
teaching shell scripting: cool scripting examples? fax8 Linux - General 1 04-20-2006 05:29 AM
linux scripting desheikh Linux - General 2 10-05-2005 06:45 AM
Scripting in Linux Rv5 Programming 2 09-05-2004 11:14 PM
Linux Scripting netkepala Linux - Networking 5 02-21-2003 10:14 PM
Linux scripting... WeNdeL Linux - Newbie 7 10-20-2002 01:48 AM

All times are GMT -5. The time now is 11:09 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration