when i read linux boot scripts, i often meet this expression: ${1:-}. i can't understand it. what's more, i don't understand this condition: [ -z "${1:-}" ] too. anyone can help me ? thanks!!!

Recommended Answers

All 2 Replies

When i read linux boot scripts, i often meet this expression: ${1:-}. i can't understand it. what's more, i don't understand this condition: [ -z "${1:-}" ] too. anyone can help me ? thanks!!!

 ${parameter:-word}
           Use Default Values. If parameter is unset or null,
           the  expansion of word will be substituted; other-
           wise, the value of parameter will be substituted.

 -z string True, if length of string is zero.

doing 'man ksh' yields:

${parameter:-word}
           Use Default Values. If parameter is unset or null,
           the  expansion of word will be substituted; other-
           wise, the value of parameter will be substituted.

 -z string True, if length of string is zero.
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.