#!/bin/sh -x
#This script counts how many people
# are in the group specified as the first argument
grp=${1:?"Missing argument"} # get group ID number
# If missing, report an error and exit.
awk -F: '
# Awk script starts here
BEGIN {
# set total to zero
# before we start
total=0;
}
$3 ~ /^'$grp'$/ {total++;}
END {
# end of file, print total
printf("Total: %d\n", total);
}' </etc/passwd
Интересует что за синтаксис такой и как оно выполняется, а так же где это описано:
Я нашел только тренарный оператор в стиле Си:
условие?если_выполняется_значение_берем_это:если _не_выполняется_то_значение_вот_это
Всем заранее спасибо. Уже 3 человека мозг на этом сломали.
${parameter:?word}
Display Error if Null or Unset. If parameter is null or unset, the expansion of word (or a message to
that effect if word is not present) is written to the standard error and the shell, if it is not
interactive, exits. Otherwise, the value of parameter is substituted.