Bourne shell script

I need a bourne shell script that reads a test case from the input
data file and compare it to its corresponding output. If there is a
difference,the script must print the line number of the input test
case in a result file. Script output and the expected output( givenin
a file called output.txt ) must be compared using "diff" utility.

The purpose of thisscript is black box testing:

thank you in advance
0
ibbu79
7/22/2003 7:21:46 PM
comp.unix.shell 15263 articles. 0 followers. Post Follow

1 Replies
279 Views

Similar Articles

[PageSpeed] 3
Excluded_Middle wrote:

> Alan Connor <xxxxxx@xxxx.xxx> wrote in message news:<klgTa.16937$Mc.1287821@newsread1.prod.itd.earthlink.net>...
> 
>>On 22 Jul 2003 12:21:46 -0700, Excluded_Middle <ibbu79@hotmail.com> wrote:
>>
>>>I need a bourne shell script that reads a test case from the input
>>>data file and compare it to its corresponding output. If there is a
>>>difference,the script must print the line number of the input test
>>>case in a result file. Script output and the expected output( givenin
>>>a file called output.txt ) must be compared using "diff" utility.


If the program to test reads from standard input:

#!/bin/ksh

integer line=0
while read test_case; do
   print -- "$test_case" |
   program_to_test |
   diff expected_output_file - |
   sed -e "s/^/line number $line: /"
   ((integer += 1))
done < input_data_file

If the program to test reads command line arguments, replace

   print -- "$test_case" | program_to_test | ...

with

   program_to_test $test_case | ...


>>I am going to save you, perhaps, from getting your ears boxed here:
>>
>>This ng is not a script dispensary, but, actually, a college of sorts, where
>>shell masters teach. (and some novices, like me, occassionally play at it :-)
>>
>>If you just want a script but don't want to learn shell scripting, then hire
>>one of the pros here.
> 
> People like you can help me alot by not participating in the
> discussion. If you don't know the how to do it then please don't reply
> to the group.


You're the one who doesn't know how to do it, or how to go about
asking for help doing it.


>>Otherwise, work through one of the many fine tutorials available*, do the best
>>you can at writing the script you want, THEN post it and ask for help.
> 
> I'll do that even if you don't advise me but everything take some
> time.


You posted before you even took the time to do `man diff`.


-- 
Kevin Rodgers

0
Kevin
7/23/2003 11:51:57 PM
Reply:
Similar Artilces:

US-MD-Rockville: Developer, C, shell scripts, UNIX, Sun/Solaris, VB, Visual C+, (45298932400)
US-MD-Rockville: Developer, C, shell scripts, UNIX, Sun/Solaris, VB, Visual C+, (45298932400) ============================================================================================= Position: Developer Reference: SMC01348 Location: Rockville MD Duration: 2M Skills: Strong experience in C programming, shell scripts, and Unix. Strong Sun/Solaris background. isual Basic, Visual C++, and familiarity with Microsoft a plus. Scope: This position will provide operational application maintenance and enhancement ...

Default shell action
Hello everyone, I'm currently writting a program which has a file pane that mimics Explorer's file pane. This is done in VB, but it shouldn't make any difference I suppose. I'm currently using registry functions to determin what shell actions are supported for a file to fill in the context menu of that file. In Explorer, the default action has it's font set to bold and I would like to mimic that. I've read that the first entry to have been added to the registry is the one that is the default. I haven't found a way to determin this... It doesn't seem...

script to mail@localhost when system reboots
Hi Everyone, I have to create a script which sends a mail everyttime the system reboots so I used the /var/log/wtmp file to gather the information when the system reboots..But what I have written only works for reboots which have already taken place. Can a script be developed which can send mails to the system administrator whenever the system is going for rebooting... Thanks Danish On 11 Apr 2006 23:04:14 -0700, danish wrote: > Hi Everyone, > I have to create a script which sends a mail everyttime the system With over 300+ linux distributions, you may want to read http://www.catb.o...

force URLencoding script
Hi. I'm trying to figure out how to force URLencoding in my Python 2.4.3 environment receiving data an input argument but I'm really at a loss here. What am I doing wrong? #!/usr/bin/env python import sys from urllib import urlencode, urlopen from urllib2 import Request import urlparse destination =3D sys.argv[1] msg =3D sys.argv[2] #Will I have problems with this one if the input is multiline? # the browser identifies itself using the User-Agent header # after creating the Request object, it's possible to pass in a dictionary of headers user_agent =3D 'Mozilla/4.0 (comp...

Need help reg Unix Script
Hi All, I am relatively new to Unix scripting. I have to write a script based on below logic- Upon start, record the current date (CURRENT_DATE) while (current timestamp is less then or equal [CURRENT_DATE + STOP_TIMESTAMP]) { Execute the script XYZ if script return code is not 0 return "return code" from the script } return 0 /****************************************/ However, I have written this script , but the return variable being talked about shoul actually be based on a perl script's execution. The flow is- XYZ-->ABC(shell)\script)-->AB(Perl script) 1)How do I get...

why this simple bash script doesn't run on my G5 OS X Tiger?
Hi, All, This is my first try to use shell scripts on Mac. And I can't figure out why this simple script doesn't run. $> vi testscript.sh #!/bin/bash echo "Hello Test" $> ls -l -rwxr-xr-x 1 kr kr 28 May 30 00:41 testscript.sh $> testscript.sh -bash: run: command not found So, what am I missing here. I checked "Excute this command..." as "/bin/bash", but it should run anyway according to the guide on the Mac web site. The command line, $>echo "Hello" works fine though. Thanks in advance, KR Key-Rok Choi wrot...

Using curses for a new shell.
Hi, We'r using curses to build a new shell. Have a look at: http://reyn.co.za/rushtest2.png and http://rubyforge.org/projects/rush/. The shell uses ruby, thus ruby objects can be piped to one another. We also have a virtual filesystem in the works to handle ftp/tarballs and some of the more basic shell concepts like aliasing, directory tab completion as well as ruby syntax completion One of the biggest problem we'v run in thus far is handeling existing binaries like: ls --color, spesifically because they emit color escape codes which curses doesnt transform into color itself. The way ...

Is there a Bourne script debugger/syntax checker?
Maybe the subject doesn't really explain what I mean. I have a rather complex script that is meant for backing up four of our servers. The basic premise is that three sets of processes need to be shut down in order (two on one server first, one on the other server afterwards, repeat for DR servers); the backup runs; the processes are restarted in reverse order of shutdown. These are all being done from a single script in a single location with trusted remote execution between the backup server and the four servers that are being backed up to eliminate the need to have scripts al...

Integrate cplusplus with tcl script?
The process core dump when executing "34:Tcl_DeleteInterp(interp);"�� the code�� ---------------------------------------------------------------- 01:Tcl_Interp *interp ; 02:char temp[256]; 03:this->setSuccess(true); 04:this->setOutParams(""); 05:interp = Tcl_CreateInterp() ; 06:int result = 0 ; 07:int ret = Tcl_Init( interp ); 08:if(ret != TCL_OK){ 09: Tcl_DeleteInterp(interp); 10: msg.set_errorMsg( "Unable to Initialize Tcl!" ); 11: return -1 ; 12:} 13:Tcl_CreateCommand( interp, "CReturn", scriptReturn, (ClientData)this,(Tcl_CmdDeletePro...

running a script through emailing
I wanted to know about some way that will enable me to run a script by sending an email to the unix system (maybe admin). Help appreciated. Thanks -- Zia "Zia Mulla" <zmulla@cisco.com> writes: > I wanted to know about some way that will enable me to run a script by > sending an email to the unix system (maybe admin). Check the manual for your MTA, it usually has some way of aliasing an address to a program. -- M�ns Rullg�rd mru@inprovide.com Zia Mulla wrote: > I wanted to know about some way that will enable me to run a script by > sending an email to the ...

which shell to use
what is the best shell to use for scripting. I imagine that it is just a preference thing, but I want to know what looks best on a resume :) sysadmin / financial industry - if it makes a diff. i always thought bash, but ive been seeing a lot of ksh since i switched to solaris. In article <pan.2004.06.03.13.06.47.917935@no.spam>, d0x <dan@no.spam> wrote: > > >what is the best shell to use for scripting. I imagine that it is just a >preference thing, but I want to know what looks best on a resume :) >sysadmin / financial industry - if it makes a diff. > >i a...

Synchronization, profiles, printers and scripting
I am running a windows 2003 server domain. My users have redirected folders ( "\\servername\share$\%username%\my documents" ) and they all share the same desktop ( "\\servername \desktop$" ). I have 1300 users and only 300 workstations, so a workstation gets used by multiple users. Also there are 25 printer around the network. Some plugged directly into the network, some to workstations via usb cables and shared. Users have vbs logon script that runs when they logon, and a vbs script that runs from group policy that deletes all shared printers and mapped...

live see foods top shell and mud crab
live see foods top shell and mud crab http://virgo-trading-inc.blogspot.com ...

Updating emacs shell completion cache
I am sorry if this question have been asked before but I couldn=92t google an answer. I am almost exclusively using the Emacs interactive shell mode as my shell and I am very frequently changing my $PATH variable when working on different projects so that I have access to different scripts store a different places. However, if I change the variable after I had fire up a shell, the auto completion won=92t reach the new location in $PATH. I am sure there is a way to refresh the content of the cache variable, I just couldn=92t find it yet. Any help would be appreciated. Thanks --...

PHP chat script without MySQL
Is there PHP chat script *without* MySQL? Demands: absolutely FREE (no adware, shareware etc.), No MySQL needed, one permanent public chat, can make your own channels (public/private) like IRC, several admins (one superadmin, me ;-D ), bad word filter, user nick ban/ip ban/kick (temporary/permanent), small file sharing and @time script ( http://www.swatch.com/internettime/home.php ) to upper right corner. Environment: Windows 2000 Pro FIN + SP2 (finnish versions), PHP 4.2.2 and Apache 2.0.46. I have tried to search that kind of script from google found nothing. -- Timo-Pekka Oikarinen (E-m...

I want a suggestion to write a script for automation
In our lab, there are many unix boxes taht are interconnected to be a local network to run our own protocols, and our job is to test these protocols. Each time I want to do some job in these unix boxes, I have to open a lot of xterm consoles and login using telnet. I'm tired to typing the command "telnet".. and Iwant to do it automatically to open consoles, login into unix boxes. Then I can do jobs in these xterms. any suggestion appriciate!I On 2006-07-04, valpa wrote: > In our lab, there are many unix boxes taht are interconnected to be a > local network to > run o...

script that remove itself
Hi, I am new to shell script . Is it possible to write a script that delete itself after running . means suppose i have a script in /usr/src/script.sh when i run the script it will do the job and when the script finish it will remove itself . Hope it is clear .please help me . Thx. learnq <learnq@gmail.com> wrote: > Hi, > > I am new to shell script . Is it possible to write a script that delete > itself after running . rm $0 -- Daniel "learnq" <learnq@gmail.com> writes: > means suppose i have a script in /usr/src/script.sh when i run the > scr...

Python CGI Scripting Documentation #2
Hello, I would like to learn web scripting with Python (sure, everyone uses PHP, but I don't like the syntax and Python is more general-purpose and... well, I guess you people know the advantages better than me). Where can I get a thorough introduction to both CGI and using Python for CGI? That includes installing my own web server (at home, for testing) and starting from scratch (by that I mean I have near null experience with CGI). I have tried looking through the source code of MoinMoin, but it's just too advanced for me -- I simply don't know where to start. Right now, I'...

implementing a shell 362535
I wanted to implement a toy shell(resembling tcsh) as a part of another project. Is there any source code/links for that ?Googling didnt help much -Thanks. On Sat, 11 Sep 2004, dada wrote: > I wanted to implement a toy shell(resembling tcsh) as a part of another project. > Is there any source code/links for that ?Googling didnt help much Why don't you start with tcsh's source code? -- Rich Teer, SCNA, SCSA, author of "Solaris Systems Programming", published in August 2004. President, Rite Online Inc. Voice: +1 (250) 979-1638 URL: http://www.rite-group.com/rich u...

Unix Shell Script to convert between Big and Little Endian #3
Hello, Can anyone post a shell script that can convert a binary file from little to big Endian or vice versa? Or is there one that can do this? I can use the 'dd' command line except that always flips every 2 bytes so a 4 byte number wouldn't be converted right. Thank you, Kennth ...

Using variables set in a bourne subshell
I have the following code that works fine in ksh, but I have to use the bourne shell. The trouble is that in the bourne shell, line A doesn't know of any changes made in line B. How can I get line A to know the value of EX without using a temporary file? ########## EX=YES while [ $EX = YES ] #line A do EX=NO cmd | while read . . . do if [ . . . ] then . . . if [ . . . ] then . . . EX=YES #line B fi . . . [ $EX = YES ] &&...

add shipping to order total script?
I'm trying to modify this script... <script language="JavaScript" type="text/javascript"> <!-- /* This script is Copyright (c) Paul McFedries and Logophilia Limited (http://www.mcfedries.com/). Permission is granted to use this script as long as this Copyright notice remains in place.*/ function CalculateTotal(frm) { var order_total = 0 // Run through all the form fields for (var i=0; i < frm.elements.length; ++i) { // Get the current field form_field = frm.elements[i] // Get the field's name form_name = ...

Shell out without so many threads?
Long ago I carefully implemented a Shell out command, following the guidance from this: http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html Summary: use threads to gather stdout and stderr from your exec, otherwise it might deadlock. I even added (yet another) thread to implement timeouts (to kill a shell script gone infinite). Time moves on, and I now, under Tomcat, have a secondary problem. My threads are thrashing. I'm using 4 threads (main, stdout_gather, stderr_gather, timeout) per shell, and it's just too many. Does anybody have any advice, experience, or code...

Another scripting language implemented into Python itself?
I am interested in developing an application where the user has an ample amount of power to customize the application to their needs, and I feel this would best be accomplished if a scripting language was available. However, I want to code this application in Python, and I have not yet heard of an implementation of another scripting language into Python. An example of what I mean is this (an implementation of Lua into Ruby -- which I'd prefer not to use): http://ruby-lua.unolotiene.com/ I know C/C++ might be better suited for a task of this kind, but most of the modules in my application...

Problem with wishx start script from http://wiki.tcl.tk/207
Hello, I'm beginner and have a problem to start some old wishx scripts. I've not found packages for my debian but have read I can use a small script named wishx (from above site) to use the old one with tcl tk and tclx: #!/bin/sh #\ exec wish "$0" ${1+"$@"} package require Tk package require Tclx set args [lassign $args argv0] source $argv0 But it didn't work at give only the following output: Error in startup script: can't read "args": no such variable while executing "lassign $args argv0" invoked from within "set args...