Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
att
GitHub Repository: att/ast
Path: blob/master/src/cmd/std/yes.sh
1808 views
1
########################################################################
2
# #
3
# This software is part of the ast package #
4
# Copyright (c) 1989-2012 AT&T Intellectual Property #
5
# and is licensed under the #
6
# Eclipse Public License, Version 1.0 #
7
# by AT&T Intellectual Property #
8
# #
9
# A copy of the License is available at #
10
# http://www.eclipse.org/org/documents/epl-v10.html #
11
# (with md5 checksum b35adb5213ca9657e911e9befb180842) #
12
# #
13
# Information and Software Systems Research #
14
# AT&T Research #
15
# Florham Park NJ #
16
# #
17
# Glenn Fowler <[email protected]> #
18
# #
19
########################################################################
20
#
21
# yes.sh
22
# Written by David Korn
23
# AT&T Labs
24
# Wed May 16 09:23:23 EDT 2007
25
#
26
case $(getopts '[-]' opt "--???man" 2>&1) in
27
version=[0-9]*)
28
usage=$'[-?@(#)yes (AT&T Labs Research) 2012-06-06\n]
29
'$USAGE_LICENSE$'
30
[+NAME?yes - repeatedly out a string until killed]
31
[+DESCRIPTION?\byes\b repeatedly writes \astring\a to standard
32
output, followed by a \anewline\a character, until it
33
is terminated. If \astring\a is omitted then
34
then \by\b is used.]
35
36
[string]
37
38
[+EXIT STATUS?]{
39
[+0?Success.]
40
[+>0?An error occurred.]
41
}
42
'
43
;;
44
*)
45
usage=''
46
;;
47
esac
48
49
while getopts "$usage" var
50
do case $var in
51
esac
52
done
53
shift $((OPTIND-1))
54
string=${@-y}
55
case $KSH_VERSION in
56
'') echo=echo ;;
57
*) echo="print -r --" ;;
58
esac
59
while :
60
do $echo "$string"
61
done
62
63