The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Operating Systems > HP-UX
.
google unix.com



HP-UX HP-UX (Hewlett Packard UniX) is Hewlett-Packard's proprietary implementation of the Unix operating system, based on System V.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
UNIX newbie NEWBIE question! Hanamachi UNIX for Dummies Questions & Answers 4 03-28-2009 04:10 PM
S-231: Adobe Form Designer and Form Client Vulnerabilities iBot Security Advisories (RSS) 0 03-27-2008 10:10 AM
Changing Unix form to Microsoft Word form to be able to email it to someone. Cheraunm UNIX for Advanced & Expert Users 8 05-24-2002 04:58 AM
Unix/Linux Newbie(ish) Question - IPC/Signals theultimatechuf High Level Programming 2 01-20-2002 11:38 PM
Newbie question about unix flavours Balaji UNIX for Dummies Questions & Answers 3 11-28-2000 01:12 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 07-24-2008
wesleywu wesleywu is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 2
Question form unix newbie

hi, just starting to learn about unix in school. got stuck on shell script chapter and need some help i completed task one but the other four is byond me.

Task 1) Write a shell script/program called dow that takes no arguments and displays just the current day of the week in lower case (i.e. mon, tue, etc.). Hint: use date command piped to tr. You will eventually turn in the following:
a) cat dow
b) dow


Task 2)
Create two files as a preliminary to this project. Make the file named names1 contain:

hd
ts
ee
edgar
Make a second file named names2 contain:
mary
ee

hd

edgar
Write a shell script named nameit that outputs a sorted list of unique names from the files. Sample output:

edgar ee hd mary ts

The shell script nameit should contain two Unix commands:

1) First assign the unique lines to a variable named NAMELIST by using the –u option on sort.

Example: to assign the output of the date command to a variable named MYDATE one would typeMYDATE=`date` (those are backquotes around the date).

2) Then display the value of the variable NAMELIST twice within the script using echo, once before the assignment, second after the assignment.
NOTE: Do not create NAMELIST at the system prompt.
You will be turning in the following commands later but you can try them out now:
a) cat names1 names2
b)cat nameit
c) nameit
d)echo $NAMELIST

The last echo commands show that the shell variable NAMELIST no longer exists after the script has been executed.


Task 3) Write a shell script called nbin that uses the if/else statement. Here is the script described in English:

"If there is no bin directory under the current directory, then display the message No local bin here; else display the message bin has XX files" (Note: the XX will be substituted with the acutal number of files in your bin directory)

You will eventually turn in the following:

a) cat nbin
b) nbin


Task 4)
Write a shell script called verbose that takes no arguments. Store separate parts of the output from the date command into shell variables using cut within backquotes. Then use these shell variables to create the following sample output.

Today is Mon day 11 of Nov in year 2001 at 11:49
You will eventually turn in the following.
a) cat verbose
b) verbose

Last edited by wesleywu; 07-24-2008 at 07:33 PM..
 

Bookmarks

Tags
unix commands

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:34 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0