![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| help me in sending parameters from sqlplus script to unix shell script | Hara | Shell Programming and Scripting | 2 | 01-29-2008 03:31 PM |
| Shell Script: want to insert values in database when update script runs | ring | Shell Programming and Scripting | 1 | 10-25-2007 04:06 AM |
| here document to automate perl script that call script | hogger84 | Shell Programming and Scripting | 3 | 10-22-2007 11:15 AM |
| returning to the parent shell after invoking a script within a script | gurukottur | Shell Programming and Scripting | 5 | 09-26-2006 08:05 AM |
| return valuse from child script to parent script | borncrazy | Shell Programming and Scripting | 1 | 08-20-2004 04:39 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
is this script right???
my friend has challenged me to this
shell program,count85, that reads the command line arguments, counts the number of options (those arguments that start with a - , and counts the number of arguments (those arguments that do not start with a -. (hint use case ... -*) *) ) Output all of the options on one line and all of the arguments with their counts on another line. #!/bin/bash # next echo to show the input echo "here comes $*" for i in $* do if echo $i | grep ^- > /dev/null # the echo and | above is because grep looks # for data in a file or stdin not in a variable # grep ^- $i would not work then echo "$i is an option" else echo "$i is an argument" fi done echo "done with optiontest with $*" # summation and data passed for info only dont know if i did it right or not output is here comes done with optiontest with is my if then else statement not correct thanks airmax_sk@yahoo.com Last edited by kim187; 04-28-2008 at 10:25 PM.. Reason: change |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|