Skip to main content
added 2 characters in body
Source Link
GAD3R
  • 69.9k
  • 32
  • 147
  • 216

I summarized Stéphane Chazelas' answer:

  • ${1:+"$@"}' test if $1 null or unset
  • ${1+"$@"}' test if $1 unset

so if use second one with parameter "", that means $1 is null, but it doesn't test whether it is null or not, it just see it have been already setted nevertheless it it empty or not, so it will expand $@, but you use ${1:+"$@"}' with "", it will not expand $@$@ any more.

I summarized Stéphane Chazelas' answer:

  • ${1:+"$@"}' test if $1 null or unset
  • ${1+"$@"}' test if $1 unset

so if use second one with parameter "", that means $1 is null, but it doesn't test whether it is null or not, it just see it have been already setted nevertheless it it empty or not, so it will expand $@, but you use ${1:+"$@"}' with "", it will not expand $@ any more.

I summarized Stéphane Chazelas' answer:

  • ${1:+"$@"}' test if $1 null or unset
  • ${1+"$@"}' test if $1 unset

so if use second one with parameter "", that means $1 is null, but it doesn't test whether it is null or not, it just see it have been already setted nevertheless it it empty or not, so it will expand $@, but you use ${1:+"$@"}' with "", it will not expand $@ any more.

gammar typos s/summarised/summarized/ s/weather/whether/ s/neverless/nevertheless/
Source Link
user79743
user79743

I summarisedsummarized Stéphane Chazelas' answer:

  • ${1:+"$@"}' test if $1 null or unset
  • ${1+"$@"}' test if $1 unset

so if use second one with parameter "", that means $1 is null,but but it doesn't test weatherwhether it is null or not,it it just see it have been already setted neverlessnevertheless it it empty or not,so so it will expand $@,but but you use ${1:+"$@"}' with "",it it will not expand $@ any more.

I summarised Stéphane Chazelas' answer:

  • ${1:+"$@"}' test if $1 null or unset
  • ${1+"$@"}' test if $1 unset

so if use second one with parameter "", that means $1 is null,but it doesn't test weather it is null or not,it just see it have already setted neverless it it empty or not,so it will expand $@,but you use ${1:+"$@"}' with "",it will not expand $@ any more.

I summarized Stéphane Chazelas' answer:

  • ${1:+"$@"}' test if $1 null or unset
  • ${1+"$@"}' test if $1 unset

so if use second one with parameter "", that means $1 is null, but it doesn't test whether it is null or not, it just see it have been already setted nevertheless it it empty or not, so it will expand $@, but you use ${1:+"$@"}' with "", it will not expand $@ any more.

fixed presentation
Source Link
Archemar
  • 32.3k
  • 18
  • 75
  • 107

I summarised Stéphane Chazelas' answer: ${1:+"$@"}' test if $1 null or unset
${1+"$@"}' test if $1 unset

  • ${1:+"$@"}' test if $1 null or unset
  • ${1+"$@"}' test if $1 unset

so if use second one with parameter "", that means $1 is null,but it doesn't test weather it is null or not,it just see it have already setted neverless it it empty or not,so it will expand $@,but you use ${1:+"$@"}' with "",it will not expand $@ any more.

I summarised Stéphane Chazelas' answer: ${1:+"$@"}' test if $1 null or unset
${1+"$@"}' test if $1 unset

so if use second one with parameter "", that means $1 is null,but it doesn't test weather it is null or not,it just see it have already setted neverless it it empty or not,so it will expand $@,but you use ${1:+"$@"}' with "",it will not expand $@ any more.

I summarised Stéphane Chazelas' answer:

  • ${1:+"$@"}' test if $1 null or unset
  • ${1+"$@"}' test if $1 unset

so if use second one with parameter "", that means $1 is null,but it doesn't test weather it is null or not,it just see it have already setted neverless it it empty or not,so it will expand $@,but you use ${1:+"$@"}' with "",it will not expand $@ any more.

Source Link
Kevin
  • 37
  • 1
Loading