UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 29th, 2004, 11:21 PM
vinnie48 vinnie48 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Location: Az
Posts: 4 vinnie48 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Just cannot get this script right

I did fine o my first script i wrote but this one I can not seem to get it right? This is what I am suppose to do??Write a shell script named showparms which will disp1ay each positional parameter from the shell command line (including $0), as well as the argument count $# and the entire set of command line parameters $@. Your script should display as many positional parameters as there are arguments, but if there are more than nine arguments on the command line display only the first nine positional parameters ($1 through $9). In either case, $@ should show all of the arguments. Be sure to include appropriate comments in your script so I will know what your script is doing. Each parameter should be displayed on a separate line which shows the parameter name and has the parameter value delimited by the angle brackets < and > so that it will be possible to see an argument which consists of a null string (“”) or a blank space or spaces (“ “). As an example:



$ showparms 3 “ ” “a b c” “” “Dec 15”



Your ouput should be like this:



$# = 5

$0 = <showparms>

$1 = <3>

$2 = < >

$3 = <a b c>

$4 = <>

$5 = <Dec 15>

$@ = <3 a b c Dec 15>



The $@ is a list of all arguments. When displaying the value for $@, make sure you can account for all of the space characters which are displayed. There should not be too few or too many. In the example above, there is one space between each of the command line arguments, one additional space for the parameter $2 since it is “ ” and no additional spaces for the parameter $4 since it is “”.



Execute your script with a command line of fewer than nine arguments and a command line of more than nine arguments. When there are fewer than nine arguments you should only display as many positional parameters as there are arguments. For example, if there are four arguments you should not display the $5 argument. IF there are more than nine arguments then you should not try to display $10 since there is no such thing! Thank

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > Just cannot get this script right


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway