[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: script bash



On Mon, 27 Jun 2005 09:24:00 +0200
Daniele Cortesi <dan@linux.it> wrote:

> Tanto  per  precisare:  test  e [  sono  entrambi  programmini,  l'unica
> differenza è che il secondo richiede una ']' dopo la condizione.
> 
> $ info coreutils test

Dovrei consultare più spesso la documentazione locale piuttosto che
cercare in rete :)

Quanto ho forse espresso in maniera approssimativa nel precedente
messaggio è che mentre da console occorre far riferimento al comando 

/usr/bin/test 

od

/usr/bin/[ 

ed alle relative documentazioni, in uno shell script fa testo la shell
stessa ove, tali funzioni potrebbero essere implementate come builtin (lo
sono ad esempio in Bash). Da:

info coreutils test

si legge, infatti:

"Because most shells have a built-in command by the same name, using
the unadorned command name in a script or interactively may get you
different functionality than that described here."

In ABS [1] l' esempio 7-2, titolato:

"Equivalenza di test, /usr/bin/test, [ ]  e /usr/bin/[" [2]

chiarisce molto bene gli usi ed i limiti di utilizzo delle diverse
possibilità

[1] http://ildp.pluto.it/guide/abs/index.html
[2] http://ildp.pluto.it/guide/abs/tests.html#EX11

Ciao :)



Reply to: