![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
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 |
| Linux Shell Question: how to print the shell script name ? | meili100 | UNIX for Dummies Questions & Answers | 3 | 07-01-2008 01:55 PM |
| shell script question | tselvanin | Shell Programming and Scripting | 2 | 08-28-2007 09:53 PM |
| A shell script question | surjyap | Shell Programming and Scripting | 2 | 11-24-2005 05:48 AM |
| Simply shell script question | frustrated1 | Shell Programming and Scripting | 8 | 07-03-2005 02:22 AM |
| BASH shell script question | ewarmour | Shell Programming and Scripting | 3 | 05-24-2002 05:10 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Shell script question
Hello, i am doing a project for school and i cannot figure out whats wrong with my 2 programs they dont seem to work at all.
the first program is called isprime and naturally it checks to see if hte number is prime or not here is my code: #!/usr/bin/bash num=$1 echo you typed [$num] if [ $num -gt 0 ] ; then for mrv in `seq 2 $(($num/2))` ; do modulo=$(( $num % $mrv)) if [ $modulo -eq 0 ] ; then echo "is not prime" exit fi done else echo ERROR fi my second program is called unscramble its supost to take in text and unscramble it to a word #!/usr/bin/bash word=$1 len=${#word} cmd="egrep -i \"\<[$word]{$len}\>\" /usr/dict/words" lp=0 while [ $lp -lt $len ] ; do cmd="$cmd|grep ${word:$lp:1}" ltr=${word:$lp:1} dbl=`echo $word|egrep "($ltr).*\1"` if [ -n "$dbl" ] ; then echo $ltr is a double fi lp=$((lp+1)) done eval "$cmd" all this programming is very new to me and i can get confused easily any help would be great thank you |
|
||||
|
Quote:
Code:
2>/dev/null |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Tags |
| bash, bash eval, eval |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|