Skip to main content
misprint fix
Source Link
gluk47
  • 221
  • 3
  • 10

My 5 cents: there is also a shorter syntax thatthan if ..., this one:

VALUE="${1?"Usage: $0 value"}"

This line will set VALUE if an argument has been supplied and will print an error message prepended with the script line number in case of an error (and will terminate the script execution).

Another example can be found in the abs-guide (search for «Example 10-7»).

My 5 cents: there is also a shorter syntax that if ..., this one:

VALUE="${1?"Usage: $0 value"}"

This line will set VALUE if an argument has been supplied and will print an error message prepended with the script line number in case of an error (and will terminate the script execution).

Another example can be found in the abs-guide (search for «Example 10-7»).

My 5 cents: there is also a shorter syntax than if ..., this one:

VALUE="${1?"Usage: $0 value"}"

This line will set VALUE if an argument has been supplied and will print an error message prepended with the script line number in case of an error (and will terminate the script execution).

Another example can be found in the abs-guide (search for «Example 10-7»).

Source Link
gluk47
  • 221
  • 3
  • 10

My 5 cents: there is also a shorter syntax that if ..., this one:

VALUE="${1?"Usage: $0 value"}"

This line will set VALUE if an argument has been supplied and will print an error message prepended with the script line number in case of an error (and will terminate the script execution).

Another example can be found in the abs-guide (search for «Example 10-7»).