Help on these basic scripts


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help on these basic scripts
# 1  
Old 07-26-2011
Help on these basic scripts

1. Write a program 'suffix' that renames a file by adding the characters given as the second argument to the end of the name of the file given as the first argument. So.....

suffix memo1 .sv

should rename memo1 to memo1.sv.

2. Write a program called "t" that displays the time of day in a.m. or p.m. notation rather than in 24-hour clock time. Here's an example showing "t" run at night:


Code:
$ date

Wed Aug 28 19:34:01 EDT 2002

$ t

7:21 pm

$

Use the shell's built-in integer arithmetic to convert from 24-hour clock time. Then rewrite the program to use a case command instead. Rewrite it again to perform arithmetic with the expr command.

3. Here are two programs called prog1 and prog2:

Code:
$ cat prog1

e1=100

export e1

e2=200

e3=300 prog2


$ cat prog2

echo $e1 $e2 $e3 $e4

$

What output would you expect after typing the following:

Code:
$ e2=20; export e2

$ e4=40 prog1


Thank you

Last edited by radoulov; 07-26-2011 at 11:01 AM.. Reason: Code tags.
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

KSH - How to call different scripts from master scripts based on a column in an Oracle table

Dear Members, I have a table REQUESTS in Oracle which has an attribute REQUEST_ACTION. The entries in REQUEST_ACTION are like, ME, MD, ND, NE etc. I would like to create a script which will will call other scripts based on the request action. Can we directly read from the REQUEST_ACTION... (2 Replies)
Discussion started by: Yoodit
2 Replies

2. Fedora

I need urgent help - Basic shell scripts but I'm clueless.

Hello. I am currently in a class dealing with shell scripts. I know some commands and get the basics of command line in Fedora 11. But the coding....I'm a bit lost. I was very ill for 2 weeks and missed a lot, much of which there are no notes provided. I'm not asking you to do my homework,... (1 Reply)
Discussion started by: Feuyaer
1 Replies

3. Shell Programming and Scripting

Changing the Bash Scripts to Bourne Scripts:URGENT

Hi, I have to write a program to compute the checksums of files ./script.sh I wrote the program using bash and it took me forever since I am a beginner but it works very well. I'm getting so close to the deadline and I realised today that actually I have to use normal Bourne shell... (3 Replies)
Discussion started by: pgarg1989
3 Replies

4. Shell Programming and Scripting

Running scripts within scripts from cron

Hi all, I have set up a cron job which calls another shell script shell script which in turn calls a Java process. The cron tab looks so. 0,30 7-18 * * 1-5 /u01/home/weblogic/brp/bin/checkstatus.sh >> /u01/home/weblogic/logs/checkstatus.log The checkstatus.sh scripts looks like this. ... (4 Replies)
Discussion started by: sirbrian
4 Replies

5. Shell Programming and Scripting

Help with Script using rsh and scripts within scripts

Hi, I've written a script that runs on a Database server. It has to shutdown the Application server, do an Oracle Dump and then restart the Application server. Its been a long time since I wrote any shells scripts. Can you tell me if the scripts that I execute within my script will be executed... (3 Replies)
Discussion started by: brockwile1
3 Replies

6. UNIX for Dummies Questions & Answers

Profile scripts versus rc scripts....

what is the difference between login and profile scripts versus the rc scripts? (1 Reply)
Discussion started by: rookie22
1 Replies
Login or Register to Ask a Question