+++++++++++++++++++++++++++++++++++++++++ Sposoby odwolywania sie do zmiennych: ${parameter} Reads all the characters from the ${ (dollar sign left brace) to the matching } (right brace) as part of the same word even if it contains braces or metacharacters. The value, if any, of the parameter is sub- stituted. The braces are required when parameter is followed by a letter, digit, or underscore that is not to be interpreted as part of its name or when a named parameter is subscripted. If parameter is one or more digits, it is a positional parameter. A positional parameter of more than one digit must be enclosed in braces. If parameter is * (asterisk) or @ (at sign), all the positional parameters, starting with $1, are substituted (separated by a field separator character). If an array identifier with subscript * or @ is used, the value for each of the elements is substituted (separated by a field separator character). ${#parameter} Substitutes the number of positional parameters if parameter is * or @; otherwise, the length of the value of the parameter is substituted. ${#identifier[*]} Substitutes the number of elements in the array identifier. ${parameter:-word} Substitutes the value of parameter if it is set and non-null; other- wise, substitute word. ${parameter:=word} Sets parameter to word if it is not set or is null; the value of the parameter is then substituted. Positional parameters cannot be assigned values in this way. ${parameter:?[word]} Substitutes the value of parameter if it is set and is non-null; other- wise, print word and exit from the shell. If word is omitted, a stan- dard message is printed. ${parameter:+word} Substitute word if parameter is set and is non-null; otherwise, substi- tute nothing. ${parameter#pattern} | ${parameter##pattern} Causes the value of this substitution to be the value of parameter with the matched portion deleted if the shell pattern matches the beginning of the value of parameter; otherwise the value of parameter is substi- tuted. In the first form, the smallest matching pattern is deleted and in the second form, the largest matching pattern is deleted. ${parameter%pattern} | ${parameter%%pattern} Causes the value of this substitution to be the value of parameter with the matched part deleted if the shell pattern matches the end of the value of parameter; otherwise, substitute the value of parameter. In the first form, the smallest matching pattern is deleted and in the second form, the largest matching pattern is deleted. If the : (colon) is omitted from the previous expressions, then the shell checks only whether parameter is set or not. In the previous expressions, word is not evaluated unless it is to be used as the substituted string, so that, in the following example, pwd is exe- cuted only if d is not set or is null: echo ${d:-$(pwd)}