File: bell

package info (click to toggle)
sptk 3.9-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 8,376 kB
  • sloc: ansic: 38,342; sh: 4,834; makefile: 1,403
file content (48 lines) | stat: -rwxr-xr-x 662 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh

cmnd=$0;
n=1;

usage()
{
    cat<<EOF

 $cmnd - bell

  usage:
       $cmnd [ option ] [ num ]
  option:
       -h  : print this message
  notice:
       num : number of bell      [1]

 Replacement of the SPTK bell command

EOF
}

# Parse options
while getopts h OPT; do
    case "$OPT" in
        h)
            usage >&2;
            exit 0;
            ;;
    esac
done

# Remove the switches we parsed above.
shift `expr $OPTIND - 1`

# If we have at least one non-option argument,
# the first is used as count number.
if [ $# -gt 0 ]; then
    n=$1
fi

while [ $(( n -= 1 )) -gt 0 ];
do
    printf '\a' 1>&2;
    sleep 1;
done;
printf '\a' 1>&2;