~ubuntu-branches/ubuntu/natty/abs-guide/natty

« back to all changes in this revision

Viewing changes to abs/param-sub.sh

  • Committer: Bazaar Package Importer
  • Author(s): Sandro Tosi
  • Date: 2010-05-09 17:49:52 UTC
  • mfrom: (1.2.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20100509174952-1s583w0zbh7rl1po
Tags: 6.2-1
* New upstream release; Closes: #441278
* debian/control
  - adopting package; Closes: #577181
  - removed bzip2 from b-d-i, no more needed
  - debhelper has to be in b-d
  - bump Standards-Version to 3.8.4 (no changes needed)
  - added Homepage field
  - added misc:Depends to Depends
  - added Vcs-{Browser, Git} field
* debian/rules
  - removed the unpacking stuff, we now use an alrqady unpacked source
  - added more example scripts to fix
* debian/{compat, control, rules}
  - switched to debhelper 7
* debian/watch
  - updated to new upstream location; thanks to Raphael Geissert for the
    report; Closes: #453596
* debian/copyright
  - updated with new location and copyright/license notices
* debian/source/format
  - set source package format to 1.0 explicitly
* debian/abs-guide.doc-base
  - set Section field correctly
* debian/{copyright, abs-guide.doc-base}
  - updated upstream email
* debian/abs-guide.lintian-overrides
  - added override for "known syntax-errored" scripts

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
# param-sub.sh
 
3
 
 
4
#  Whether a variable has been declared
 
5
#+ affects triggering of the default option
 
6
#+ even if the variable is null.
 
7
 
 
8
username0=
 
9
echo "username0 has been declared, but is set to null."
 
10
echo "username0 = ${username0-`whoami`}"
 
11
# Will not echo.
 
12
 
 
13
echo
 
14
 
 
15
echo username1 has not been declared.
 
16
echo "username1 = ${username1-`whoami`}"
 
17
# Will echo.
 
18
 
 
19
username2=
 
20
echo "username2 has been declared, but is set to null."
 
21
echo "username2 = ${username2:-`whoami`}"
 
22
#                            ^
 
23
# Will echo because of :- rather than just - in condition test.
 
24
# Compare to first instance, above.
 
25
 
 
26
 
 
27
#
 
28
 
 
29
# Once again:
 
30
 
 
31
variable=
 
32
# variable has been declared, but is set to null.
 
33
 
 
34
echo "${variable-0}"    # (no output)
 
35
echo "${variable:-1}"   # 1
 
36
#               ^
 
37
 
 
38
unset variable
 
39
 
 
40
echo "${variable-2}"    # 2
 
41
echo "${variable:-3}"   # 3
 
42
 
 
43
exit 0