Regole del forum
1) Citare in modo preciso il linguaggio di programmazione usato.
2) Se possibile portare un esempio del risultato atteso.
3) Leggere attentamente le risposte ricevute.
4) Scrivere i messaggi con il colore di default, evitare altri colori.
5) Scrivere in Italiano o in Inglese, se possibile grammaticalmente corretto, evitate stili di scrittura poco chiari, quindi nessuna abbreviazione tipo telegramma o scrittura stile SMS o CHAT.
6) Appena registrati è consigliato presentarsi nel forum dedicato.
La non osservanza delle regole porta a provvedimenti di vari tipo da parte dello staff, in particolare la non osservanza della regola 5 porta alla cancellazione del post e alla segnalazione dell'utente. In caso di recidività l'utente rischia il ban temporaneo.
scusa Mario, confermi la cosa? io ricordo di aver usato più volte la sintassi VARIABILE=$(comando) anche in ash e di non aver trovato intoppi... questo è confermato anche qui, riporto un estratto:
Command Substitution
Ash accepts two syntaxes for command substitution:
`list`
and
$(list)
Either of these may be included in a word. During the
command substitution process, the command (syntactly a
list) will be executed and anything that the command
writes to the standard output will be captured by the
shell. The final newline (if any) of the output will be
deleted; the rest of the output will be substituted for
the command in the word.
questo significherebbe che neppure la ash è effettivamente un clone esatto della vecchia sh! io invece ero convinto che fosse così!
e comunque, clone esatto o meno: quale delle due espressioni e stringentemente POSIX? la prima oppure entrambe?
scusa Mario, confermi la cosa? io ricordo di aver usato più volte la sintassi VARIABILE=$(comando) anche in ash e di non aver trovato intoppi... questo è confermato anche qui, riporto un estratto:
Command Substitution
Ash accepts two syntaxes for command substitution:
`list`
and
$(list)
Either of these may be included in a word. During the
command substitution process, the command (syntactly a
list) will be executed and anything that the command
writes to the standard output will be captured by the
shell. The final newline (if any) of the output will be
deleted; the rest of the output will be substituted for
the command in the word.
questo significherebbe che neppure la ash è effettivamente un clone esatto della vecchia sh! io invece ero convinto che fosse così!
e comunque, clone esatto o meno: quale delle due espressioni e stringentemente POSIX? la prima oppure entrambe?
grazie,
M
Bourne Shell e shell della stessa generazione conoscevano unicamente:
arg1 = arg2
`cmd`
. filename
La prossima generazione in parte accetta o accetta pienamente
arg1 == arg2
$(cmd)
source filename
Per quanto sappia, una shell POSIX deve interpretare ambedue le notazioni.
Pero` una shell POSIX conosce cose non esistenti nelle vecchie, e.g.
[alnum] [alpha] [ascii] ecc.
quindi preferisco scrivere [A-Za-z0-9] per il primo, sono sicuro che funziona.
Honestly, I think /testing may be a better
place for bash-3.2 for a while longer -- it's causing trouble with many old
scripts. So, we'll give it a while longer to stabilize and for scripts to
catch up to any syntax changes which may have occurred. The fix for 99.9%
of these old scripts is to not use the deprecated `command` syntax and
instead use the $(command) syntax.
Honestly, I think /testing may be a better
place for bash-3.2 for a while longer -- it's causing trouble with many old
scripts. So, we'll give it a while longer to stabilize and for scripts to
catch up to any syntax changes which may have occurred. The fix for 99.9%
of these old scripts is to not use the deprecated `command` syntax and
instead use the $(command) syntax.
Quanti shell scripts esistono al mondo su quante macchine, vecchie e nuove?
Se `command` e` deprecato, quanti di questi scripts sono da riscrivere?
Quindi bash-3.2 porta tanto lavoro, quanti sistemi andranno in TILT?
Da subito usare $(command) e cambiare man mano gli script con `command`.
Vale solo su Linux recenti, mai toccare una vecchia macchina Sun-OS o Ultrix!
Quella in ditta, dual XEON-2800 2GB RAM 3 HD SCSI vivra` ancora anni, con Slackware 10.1.