![]() |
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 |
| Bash recursive scripting | James McMurray | Shell Programming and Scripting | 11 | 02-02-2009 12:07 PM |
| Log FILES in BASH scripting | jackdaw | Shell Programming and Scripting | 2 | 12-05-2007 04:25 PM |
| Bash shell Scripting help | keyvan | Shell Programming and Scripting | 0 | 05-15-2007 07:36 PM |
| Help!! bash shell scripting.. | Fr0z3n999 | Shell Programming and Scripting | 1 | 12-07-2006 04:08 PM |
| bash shell scripting | azazalis | Shell Programming and Scripting | 4 | 07-11-2006 04:22 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Bash Scripting
Hello there peeps:
There is a little piece of bash shell scripting problem i have, which i was hoping you could help me with. Code:
#!/bin/bash
stored_word()
{
case $(( $$ % 8 )) in
0 ) echo "energy";;
1 ) echo "touch";;
2 ) echo "climbing";;
3 ) echo "declare";;
4 ) echo "marry";;
5 ) echo "relax";;
6 ) echo "bugs";;
7 ) echo "inaccessible"
#8 ) echo "country" ;;
#9 ) echo "folder" ;;
#10 ) echo "advertisement" ;;
#11 ) echo "heading" ;;
#12 ) echo "distasteful" ;;
#13 ) echo "fashioned" ;;
#14 ) echo "variation" ;;
#15 ) echo "individual"
esac
}
Code:
word=$(stored_word)
letters=$(echo $word | wc -c)
letters=$(( $letters - 1 ))
template="$(echo $word | tr '[a-z A-Z 0-9]' '.')"
remaining=$letters
Simply what i am trying to achieve is, for the function stored_word to generate a random word and then insert it into $word, which dose. then the 2nd piece of code, mixes it all up. The main problem is they are in the same script and need to be in 2 different script. How can i achieve that, without using sed or awk? Keyvan |
|
||||
|
Quote:
Keyvan |
|
||||
|
Quote:
Code:
case $(( $RANDOM % 8 )) in |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|