Linux unix help (homework, closed)


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Linux unix help (homework, closed)
# 1  
Old 12-12-2009
Error Linux unix help (homework, closed)

i have to do this but i am confused,

Create a file containing the bash functions which perform the following tasks. Clearly label each function. Print out and turn in this file.

1.Write a function which displays the current date, time, username, and current directory.

2.Write a function which displays all of its parameters (no matter how many).

3.Write a function called reverse which will display the reverse of an integer. The function will take exactly 1 argument and display the result. That is, typing
reverse 12345
results in the output
12345 reversed is 54321

4.Write a function called comp which performs integer arithmetic (addition, subtraction, multiplication, division, and modulus). The function will take exactly 3 arguments - two operands and an operation - and display the results. That is, typing
comp 5 + 3
results in the output
5 + 3 = 8
Your function should verify that there are exactly 3 parameters.

5.Write a function called summer which will add up a list of integers (length unknown). That is, typing
summer 1 2 3 4 5
results in the output
15
Hint: First write the function to add two integers. Then create a recursive function which shifts the parameters, adding the new first parameter to the sum.
# 2  
Old 12-12-2009
Homework thread closed.

Please follow forum rules.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Linux / UNIX (Homework)

My task is to modify the command line cat -n /etc/fstab | grep and after grep, filter to only show line 7. I can't use sed awk or any other command, only grep (1 Reply)
Discussion started by: taurus1992
1 Replies

2. Red Hat

Connection closed by host error in rhel 6 Linux

Hi All, I am new to Redhat Enterprise Linux 6 version. I am facing an issue with my lab server which is having RHEL6 lab1:root> uname -a Linux lab1 2.6.32-358.18.1.el6.x86_64 #1 SMP Fri Aug 2 17:04:38 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux I am getting this error for every 18 minutes 30... (0 Replies)
Discussion started by: go2suresh1979
0 Replies

3. Solaris

Adding user with restrictions (Closed Homework)

Hello, I would to create a new user with some restriction: Example "Toto" I am a newer in unix please tell me how to do 1. The user will will have only remote access via FTP ( not telnet, ssh etc ...) 2. The user will not be able to access via FTP to other directory 4) He will access only... (1 Reply)
Discussion started by: fedeboubou
1 Replies

4. Shell Programming and Scripting

Match File and Copy File Script (Homework, Closed)

Can you please help on this? I am looking for the shell script which does following:- step 1: It should open the file /u/manish/input/FileIndex.dat and read line by line step 2: Once first line is read (for ex: File1), we have to find a file, that contains this matching... (4 Replies)
Discussion started by: teteguru1
4 Replies

5. UNIX for Dummies Questions & Answers

3 homework questions (thread closed)

1st) how can i print only directories? 2nd) how can i print files that someone used in the last X days (for example, 5). thanks very much, i need it for homework and teacher teachs us nothing:( (1 Reply)
Discussion started by: SupErioR
1 Replies

6. SCO

all tcp are CLOSED on SCO Unix on VMWARE

Hi folks, First of all, sorry about my english, isn't the best and thks for advance. Here es my problem... I have virtualize an SCO unix with VMware ESX 3 and everything was going on beatifull until that i try to connect from anorther host, i can't do it so i check the connection with... (5 Replies)
Discussion started by: martocapo
5 Replies

7. UNIX for Advanced & Expert Users

How to check a file in UNIX is closed or growing?

We have a third party tool in UNIX to kick off a 'file copy' job based on a file existance. If a specific file exists in an UNIX directory, another process should start copy the file into another system for further processing. The issue is, the copy job is starting as soon as the file exists in... (6 Replies)
Discussion started by: kslakshm
6 Replies

8. Shell Programming and Scripting

please help (closed homework thread)

I have these questions for my unix class that I can't figure out because I missed a couple of days. They are for a quiz we took last week so by answering the questions you are not bettering my grade or doing my homework. I just want to understand was the answers. My teacher is really bad at... (1 Reply)
Discussion started by: djeung
1 Replies
Login or Register to Ask a Question