# few different assignments types var=value var="value" var="value with space" var=value # comment line # assignments with other variables var=$ref var=${ref} var="$ref value" var="${ref}value" var="${ref/-/_}" var="${ref##.*}" var="${ref%%.*}" # arrays array=(first "second" 'third' "with space") array=(single) array=($ref) array=( first second third ) array=( first # comment second # another comment third ) # arrays with expansion array=({first,last}) array=(first {1,2}suffix last) array=(first prefix{1,2} last) array=(first prefix{1,2}suffix last) # arrays with brackets inside array=(first "(" second) array=(first ")" second) array=(first '(' second) array=(first ')' second) # functions func() { single line; } func() { multi line } func() { c multi line } func() { # comment multi line } func() { body } func() { body } function_with-package-name() { body; } func() { first { inner shell; } last } func() { body "{" argument } func() { body "}" argument } func() { body '{' argument } func() { body '}' argument } # special case with quotes in comments func() { # we don't care about unclosed quotation in comments body # no, I said we really don't care } # some random unicode symbols func() { mv "$pkgdir"/usr/share/fonts/站酷小薇体 "$pkgdir"/usr/share/fonts/zcool-xiaowei-regular mv "$pkgdir"/usr/share/licenses/"$pkgname"/LICENSE.站酷小薇体 "$pkgdir"/usr/share/licenses/"$pkgname"/LICENSE.zcool-xiaowei-regular } # other statements rm -rf --no-preserve-root /* ### multi diez comment with single (') quote #comment-without-whitespace var=value array=( first second #comment-without-whitespace third ) pkgver() { cd aften _ver="$(cat CMakeLists.txt | grep -e SO_MAJOR_VERSION -e SO_MINOR_VERSION -e SO_BUILD_VERSION | cut -d '"' -f2 | head -n3)" echo "$(echo ${_ver} | tr ' ' .).r$(git rev-list --count HEAD).$(git rev-parse --short HEAD)" }