~ubuntu-branches/ubuntu/trusty/bash/trusty-security

« back to all changes in this revision

Viewing changes to tests/getopts6.sub

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2014-03-03 22:52:05 UTC
  • mfrom: (1.3.5) (2.2.6 experimental)
  • Revision ID: package-import@ubuntu.com-20140303225205-87ltrt5kspeq0g1b
Tags: 4.3-1ubuntu1
* Merge with Debian; remaining changes:
  - skel.bashrc:
    - Run lesspipe.
    - Enable ls aliases.
    - Set options in ll alias to -alF.
    - Define an alert alias.
    - Enabled colored grep aliases.
  - etc.bash.bashrc:
    - Add sudo hint.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
aflag=
 
2
bflag=
 
3
 
 
4
while getopts :ac name "$@"
 
5
do
 
6
        case $name in
 
7
        a)      aflag=1 ;;
 
8
        c)      cflag=1 ;;
 
9
        ?)      exit 2;;
 
10
        esac
 
11
 
 
12
        # this came in in a bug report -- it's really a usage error
 
13
        # but it shouldn't cause the shell to crash
 
14
        shift
 
15
done
 
16
 
 
17
if [ ! -z "$aflag" ] ; then echo -a specified ; fi
 
18
if [ ! -z "$cflag" ] ; then echo -c specified ; fi
 
19
 
 
20
if [ "$OPTIND" -gt 1 ]
 
21
then
 
22
        shift $(( $OPTIND - 1 ))
 
23
fi
 
24
 
 
25
echo remaining args: "$*"
 
26
 
 
27
exit 0