![]() |
|
|
google unix.com
|
|||||||
| Forum | Registrati | Regole Forum | Collegamenti | Album | FAQ | Members List | Calendario | Ricerca | Today's Posts | Mark Forums Read |
| Shell scripting e di programmazione Pubblica domande su KSH, CSH, SH, Bash, Perl, PHP, sed, awk e da altri script di shell e linguaggi di scripting shell qui. |
Più di UNIX e Linux Forum Argomenti potreste trovare utili
|
||||
| Filo | Thread Starter | Forum | Risposte | Ultimo Post |
| $ casuale | relle | Shell scripting e di programmazione | 6 | 07-11-2008 06:59 AM |
| Random comando | melaz | Shell scripting e di programmazione | 1 | 07-10-2008 09:24 PM |
| FTP file casuale | whegra | Shell scripting e di programmazione | 3 | 11-21-2007 05:22 PM |
| Ottenere un file casuale | davidY | Shell scripting e di programmazione | 6 | 01-01-2007 05:03 AM |
| casuale in ksh | pascalbout | AIX | 1 | 01-04-2006 10:53 AM |
![]() |
|
|
LinkBack | Thread Tools | Cerca in questo Thread | Rate Thread | Modalità di visualizzazione |
|
|
|
||||
|
Random
Il mio problema è come seguire e spero di poter contribuire a:
Attualmente questa funzione sono: Codice:
stored_word()
{
number=$RANDOM
let "number %= 21"
case $number 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 "individual" ;; 11 ) echo "youngest" ;;
12 ) echo "disco" ;; 13 ) echo "disturbed" ;;
14 ) echo "company" ;; 15 ) echo "scientific" ;;
16 ) echo "disaster" ;; 17 ) echo "protection" ;;
18 ) echo "curiously" ;; 19 ) echo "deranging" ;;
21 ) echo "facilities"
esac
}
Codice:
. hangman_words
word=$(stored_word)
letters=$(echo $word | wc -c)
letters=$(( $letters - 1 ))
template="$(echo $word | tr '[a-z A-Z 0-9]' '.')"
remaining=$letters
Può uno gettato una luce su questo per favore? K |
|
||||
|
Codice:
number=$(( RANDOM % 21 + 1 )) word=$( sed -n "$number p" words_list_file ) letters=$(echo $word | wc -c) letters=$(( $letters - 1 )) template="$(echo $word | tr '[a-z A-Z 0-9]' '.')" remaining=$letters |
|
||||
|
Citazione:
Sei una stella Keyvan Ultimo a cura di Keyvan; al 05/24/2007 09:25 AM.. Motivo: maggiori informazioni |
|
||||
|
Citazione:
Codice:
no=$(( RANDOM % 21 + 1 )) while read str do (( no = no - 1 )) if [[ $no -eq 0 ]]; then word=$str break fi done < words_list_file letters=$(echo $word | wc -c) letters=$(( $letters - 1 )) template="$(echo $word | tr '[a-z A-Z 0-9]' '.')" remaining=$letters |
|
||||
|
Citazione:
[TESTO] word1 word2 word3 word4 ecc. [/ TESTO] K |
|
||||
|
Citazione:
|
|
||||
|
Citazione:
1 - $ str \u003d stringa? 2 - come dose lo script confronta e si legge la parola linea? Spero che le domande non sono stupido, solo cercando di ottenere una migliore comprensione. Thx K |
![]() |
| Segnalibri |
| Thread Tools | Cerca in questo Thread |
| Modalità di visualizzazione | Vota questo thread |
|
|