04-03-2009
Calling a subroutine with arguments
Hello,
I am having problem calling a subroutine with arguments, can any help? is the approach I am using correct?
main()
{
# This is just a subset of the code
#$b & $lnum is already define in this section of the code
checkboard $b $lnum
}
checkboards()
{
ln=$lnum
mycounter=1
if [ "$b" > 1 ] ; then
while [ "$b" < "$mycounter" ] ; do
sed -n $ln'p' TSimWager.txt | printf ' %s\n' $c
let ln=ln+1
let mycounter=mycounter+1
#echo "\nWager Number ${ln} is:" $c
done
fi
}
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
we can call the subroutines using two ways ....
1) calling subroutine name preceeded by & symbol.
2)Another one is without &symbol....
what is the diff b/w these two....
############################
#usr/bin/perl
fun;
sub fun
{
print "hi this is from perl\n";
}... (1 Reply)
Discussion started by: sarwan
1 Replies
2. AIX
Okay, so in AIX, there are various subroutines that is built in to the OS. The subroutine is I want to use is passwdpolicy(). So I want to construct a C program that will be able to pass credentials into the program and thusly into the subroutine.
I'm not asking for homework, or for someone to... (0 Replies)
Discussion started by: syndex
0 Replies
3. Programming
Hi friends
I am Administrator for a system works with uinx OS but, many times I get messages from server console inform me about Subroutine is Hanging
so what can I do to reset this Subroutine?
Note: always when I got that I restart the server but I think that is not professional solution. (3 Replies)
Discussion started by: bintaleb
3 Replies
4. Shell Programming and Scripting
All,
Is it possible to call a subroutine from the perl expect module after logging to a system that is within the same program. My situation is I need to run a logic inside a machine that I'm logging in using the expect module, the logic is also available in the same expect program.
Thanks,... (5 Replies)
Discussion started by: arun_maffy
5 Replies
5. Programming
Hello,
My problem is with compiling a program modelling shallow water.
In it there is a subroutine called stat with 9 parameters.
In the main program it is called with 9 parameters also
I'm running Ubuntu 11.04 with gfortran version 4.5.
Thanks.
---------- Post updated at 11:57 PM... (0 Replies)
Discussion started by: b_franz
0 Replies
6. UNIX for Dummies Questions & Answers
Okay I have a 1TB drive that is almost completely full with vids. I am in the process of converting them to mp4. I have two scripts right now. One is a shell script to convert them with Handbrake. The other is a script to get a sort of progress report. To make things easier to understand, I will... (0 Replies)
Discussion started by: Dalton63841
0 Replies
7. Shell Programming and Scripting
Hi,
ive a perl script, where it has a subroutine clear() in it, and i've one shell script which runs in background, from that shell script i wanted to call subroutine which is in perl script, that's perl script is not module, just simple script.
Eg:
perl script <test>
#!... (4 Replies)
Discussion started by: asarunkumar
4 Replies
8. Shell Programming and Scripting
I have a shell script like this:
#!/bin/sh
$PYTHON MetarDecoder.py < ../data/mtrs/arg1/arg2
And I'm calling it with this in perl:
my $output = `./metar_parse.sh --options`;
It's successful when I put in actual values for arg1 and arg2 in the shell script, but I'd like to pass arguments... (1 Reply)
Discussion started by: civilsurfer
1 Replies
9. Shell Programming and Scripting
I am trying to run a perl script which needs input arguments from a parent perl script, but doesn't seem to work. Appreciate your help in this regard.
From parent.pl
$input1=123;
$input2=abc;
I tried calling it with
system("/usr/bin/perl child.pl $input1 $input2");
and
`perl... (1 Reply)
Discussion started by: grajp002
1 Replies
10. Shell Programming and Scripting
Hello All,
I am in the process of learning perl.I have a perl script and based on the arguments passed it would the appropriate subroutine that is defined in the script.
Now, I need to check a value that is defined in the Environment variables and should call the subroutine only if the... (1 Reply)
Discussion started by: filter
1 Replies
lpf(8) System Manager's Manual lpf(8)
Name
lpf - general purpose line printer filter
Syntax
/usr/lib/lpdfilters/lpf [-c] [-nlogin] [-hhost] [-wwidth] [-lnum] [-iindent] [accounting file]
Description
The filter handles text data destined for impact printers: LP25, LP26, LP27, LA50, LA75, LA100, LA120, LA210, LG01. The filter regulates
the device dependencies of the printers and performs accounting functions. When the print job is done, writes accounting records to the
file specified by the af field in /etc/printcap.
The filter can handle plain ASCII files as well as files that have been preprocessed by nroff. However, it ignores escape sequences
requesting superscripting and subscripting.
You can specify the filter in both the of and the if fields of the file. For further information, see When you specify both fields, the of
filter prints the banner page only, then stops. The if filter then gains access to the printer. The if filter maintains accounting infor-
mation.
If you specify the of field only, it prints the banner page then stops and restarts to maintain accounting information.
If you specify the if field only, it sends the banner page directly to the printer. This is not a problem for most impact printers.
For a more detailed discussion on filters see the ``Line Printer Spooler Manual'' in the ULTRIX Supplementary Documents, Volume 2: Program-
mer.
The arguments passed to the filter depend on its use. The of filter is called with the following arguments:
lpf -wwidth -llength
The width and length values come from the pw and pl fields in the database. The if (or restart of) filter is passed the following
arguments:
lpf -c -nlogin -hhost -wwidth -lnum -iindent accounting file
The -c flag is optional and supplied only when control characters are to be printed; when the -l option of is used to print the file. The
-w and -l arguments are the same as for the of filter, however, they may have different values if the -w and/or -z options of were used to
print the file. The -n and -h arguments specify the login name and host name of the job owner. These arguments are used to record account-
ing information. The -i option specifies the amount of indentation to be used. The last argument is the name of the accounting file speci-
fied from the af field in the database.
Diagnostics
The lf field (default /dev/null) in the database specifies error logging file name.
Files
Printer capabilities database
See Also
lpr(1), pr(1), printcap(5), lpd(8), MAKEDEV(8), pac(8)
``Line Printer Spooler Manual,'' ULTRIX Supplementary Documents, Volume 2: Programmer
lpf(8)