Sponsored Content
Full Discussion: basic math program 4 child
Top Forums Programming basic math program 4 child Post 30301 by WIntellect on Sunday 20th of October 2002 09:07:21 AM
Old 10-20-2002
Ok - I don't know C, but i know the groundwork to Perl - so here's one Perl solution:

Code:
#!/usr/bin/perl

print "\nHello Joe, how are you today? ";
chomp( $feelToday = <STDIN> );

print "\nI am happy you are $feelToday today.";
print "\nLet's do some math. What's your first number? ";
chomp( $firstNumber = <STDIN> );

print "\nWhat's your second number? ";
chomp( $secondNumber = <STDIN> );

$mathResult = $firstNumber + $secondNumber;
print "\nThe math result is $mathResult!\n\n";

Just put it in a script, make it executable and run it. Just make sure the first line points to the location of your Perl executable on your system!

Smilie
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Having trouble writing a basic shell program

Hello. I'm trying to write a shell script that will take files that have .tar, .tar.gz, .tar.Z, .gz, .Z and .zip file extensions and uncompress and unarchive them. The script should be able to take multiple arguments. So far I can write a script using the case command that will do this but it will... (3 Replies)
Discussion started by: SeanWuzHere
3 Replies

2. Shell Programming and Scripting

writing math testing program

Can anyone create a program that would test the math skills of the user. Assume that it would test integer addition, The program should ask the question,collect the integer response, evaluate and notify the user if their answer was correct or incorrect. I would assume integers in the range... (5 Replies)
Discussion started by: ccp
5 Replies

3. Programming

parent not waiting until child complete executing another program through execl()

Hi, I am calling a program that greps and returns 72536 bytes of data on STDOUT, say about 7000 lines of data on STDOUT. I use pipe from the program am calling the above program. Naturally, I execute the above program (through execl() ) throught the child process and try to read the... (4 Replies)
Discussion started by: vvaidyan
4 Replies

4. Programming

Basic multithreaded program

I'd like to write a program (I'm flexible on language; C/C++ was my original idea but a scripting language would probably be better) that runs hundreds of programs, but only N = 4 (say) at a time. The idea is to keep all the cores on a multicore machine busy. How can I do this? In particular,... (6 Replies)
Discussion started by: CRGreathouse
6 Replies

5. HP-UX

Program monitor on BT-Basic

Hi, The "program monitor" command in BT-Basic prompt you for a user name and a password. How can I grant access only to certain users ? Thank you. (0 Replies)
Discussion started by: fosiceanu
0 Replies

6. What is on Your Mind?

Any ideas on child-control program

My auntie told me that she has been suspecting that her little kids are looking at some "illegal" sites online. She put a free web blocker on the computer, but they might be finding loopholes. She wanna install some child-control program to see what's going on. There are so many since I searched... (5 Replies)
Discussion started by: Bluerosen
5 Replies

7. Homework & Coursework Questions

Need help with Basic Unix Program

I am a newbie to UNIX. I'm learning UNIX on my own, just trying to get the jerk of how things work in UNIX environment. I am familiar with Windows environment. Can anyone pls write simple 'envprint' programs to : 1) List all the environment Information (using the -l or --l options) 2) ... (1 Reply)
Discussion started by: agup17
1 Replies

8. Shell Programming and Scripting

Perl math program

I have this math program on Perl and when I run it one of the math problems that comes up is 0/0 and perl makes the answer 4. How can I program perl to not include numbers /0? What I have for the division portion is: $solution = $num1 * $num2; ($solution, $num1) = ($num1, $solution); $question... (2 Replies)
Discussion started by: germany1517
2 Replies

9. Homework & Coursework Questions

Log file analyzer, super basic sh program

Hello! I'd like some help with this assignment. 1. The problem statement, all variables and given/known data: 1)Write a shell script that can uses two types of files as inputs, apache.log and apache.error.log 2)Make it so that you can switch between the two file types 3)Make it so that the... (5 Replies)
Discussion started by: malfiory
5 Replies
envuidgid(8)						      System Manager's Manual						      envuidgid(8)

NAME
envuidgid - runs another program with environment variables indicating a specified account's uid and gid. SYNOPSIS
envuidgid account child DESCRIPTION
account is a single argument. child consists of one or more arguments. envuidgid sets $UID to account's uid and $GID to account's gid. It then runs child. EXIT CODES
envuidgid exits 111 if it cannot find a UNIX account named account, if it runs out of memory for environment variables, or if it cannot run child. Otherwise its exit code is the same as that of child. SEE ALSO
supervise(8), svc(8), svok(8), svstat(8), svscanboot(8), svscan(8), readproctitle(8), fghack(8), pgrphack(8), multilog(8), tai64n(8), tai64nlocal(8), setuidgid(8), envdir(8), softlimit(8), setlock(8) http://cr.yp.to/daemontools.html envuidgid(8)
All times are GMT -4. The time now is 12:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy