Attenzione: generalmente non dovresti *MAI* usare $* in uno script bash, sempre "$@" (quindi dentro un double quote E "@" al posto di "*"), altrimenti si mangia gli spazi. Ci sono eccezioni, ma sono appunto eccezioni, quasi mai la norma quando parli di command line. Ecco una spiegazione, un po' più completa della mia:
https://google.github.io/styleguide/shell.xml#Quoting L'errore appare nei vari wrapper, tipo - https://github.com/lviggiano/dotfiles/blob/master/bin/java10#L2 - https://github.com/lviggiano/dotfiles/blob/master/bin/__java#L41 Si, molti degli script ti startup di vari prodotti Java lo fanno e sbagliano. Ecco un esempio banale di cosa succede altrimenti (in rosso l'errore, in verde come dovrebbe essere): *$ cat 2.sh* echo "### With \$*" echo $* echo "### With \"\$@\"" echo "$@" *$ bash 2.sh 1 2 3* ### With $* 1 2 3 ### With "$@" 1 2 3 *$ bash 2.sh 1 'with spaces'* ### With $* 1 with spaces ### With "$@" 1 with spaces *$ bash 2.sh 1 'with more spaces'* ### With $* 1 with more spaces ### With "$@" 1 with more spaces Come vedi, gli spazi vengono mangiati se non usi il quoting E ti serve Si, ho barato leggermente nel non considerare "$*", ma comunque "$@", per una command line da eseguire, è quello che ti serviva. On Wed, May 8, 2019 at 2:09 PM 'Luigi R. Viggiano' [email protected] [it-torino-java-jug] <[email protected]> wrote: > > > I uso dei wrapper script: > > $ java7 ant clean dist > > $ java8 mvn clean install > > i sorgenti di questi wrapper script sono qui: > https://github.com/lviggiano/dotfiles/tree/master/bin > > Ciao. > > --Luigi > > > > On Thu, Apr 4, 2019 at 8:49 AM Alex [email protected] > [it-torino-java-jug] <[email protected]> wrote: > >> >> >> Ciao, >> spero sia utile ;-) >> >> Buoan giornata >> >> How to Install Multiple Versions of Java on the Same Machine - DZone Java >> <https://dzone.com/articles/how-to-install-multiple-versions-of-java-on-the-sa> >> >> How to Install Multiple Versions of Java on the Same Machine - DZone Java >> >> In this post, we look at a common problem facing Java developers: how to >> install multiple versions of the JDK on... >> >> <https://dzone.com/articles/how-to-install-multiple-versions-of-java-on-the-sa> >> >> >> > -- Paolo Mossino <[email protected]>
