github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

jneitzel / v6shell

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 2
    • 1
  • Source
  • Commits
  • Network (1)
  • Issues (0)
  • Wiki (4)
  • Graphs
  • Tag: release.osh-20100228

click here to add a description

click here to add a homepage

  • Switch Branches (15)
    • master
    • osh-20070321
    • osh-20070324
    • osh-20070707
    • osh-20080109
    • osh-20080629
    • osh-20081026
    • osh-20081122
    • osh-20081213
    • osh-20090527
    • osh-20091029
    • osh-20091122
    • osh-20091127
    • osh-20091218
    • osh-20100228
  • Switch Tags (14)
    • release.osh-20100228
    • release.osh-20091218
    • release.osh-20091127
    • release.osh-20091122
    • release.osh-20091029
    • osh-20090527
    • osh-20081213
    • osh-20081122
    • osh-20081026
    • osh-20080629
    • osh-20080109
    • osh-20070707
    • osh-20070324
    • osh-20070321
  • Branch List
Sending Request…

V6 Thompson Shell Port — Read more

  Cancel

http://v6shell.org/

  Cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Zero out GIT.LOG & remove reference to it from C* files. 
jneitzel (author)
Sun Feb 28 13:31:43 -0800 2010
commit  7ee5017cf6f41b7c24427b7b785e9447a64925a2
tree    ebf57dd05fa7228d1668f5c052e9cb867258ec7d
parent  eae731f5b068d7b0576d7cbe3bcf487df15ec7fe
v6shell / if.1 if.1
100644 289 lines (286 sloc) 8.195 kb
edit raw blame history
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
.\"
.\" Copyright (c) 2004-2010
.\" Jeffrey Allen Neitzel <jan (at) v6shell (dot) org>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JEFFREY ALLEN NEITZEL ``AS IS'', AND ANY
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
.\" DISCLAIMED. IN NO EVENT SHALL JEFFREY ALLEN NEITZEL BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
.\" USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" @(#)$Id$
.\"
.\" Derived from: Sixth Edition UNIX /usr/man/man1/if.1
.\"
.\" Copyright (C) Caldera International Inc. 2001-2002. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code and documentation must retain the above
.\" copyright notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed or owned by Caldera
.\" International, Inc.
.\" 4. Neither the name of Caldera International, Inc. nor the names of other
.\" contributors may be used to endorse or promote products derived from
.\" this software without specific prior written permission.
.\"
.\" USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA
.\" INTERNATIONAL, INC. AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL CALDERA INTERNATIONAL, INC. BE LIABLE FOR ANY DIRECT,
.\" INDIRECT INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
.\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.TH IF 1 "@OSH_DATE@" "@OSH_VERSION@" "General Commands"
.SH NAME
if \- conditional command
.SH SYNOPSIS
.B if
\fIexpression\fR [\fIcommand\fR [\fIarg ...\fR]]
.SH DESCRIPTION
.I If
evaluates
.IR expression ,
and if its value is true,
returns a zero exit status or executes the specified
.I command
with the given arguments.
Otherwise, a non-zero exit status is returned.
.PP
The following primaries are used to construct
.IR expression :
.TP 10
\fB{\fR \fIcommand\fR [\fIarg ...\fR] \fB}\fR
The specified \fIcommand\fR is executed with the
given arguments to obtain its exit status.
A zero status is \fItrue\fR,
and a non-zero status is \fIfalse\fR.
.TP
.BI \-d \ file
True if \fIfile\fR exists and is a directory.
.TP
.BI \-e \ file
True if \fIfile\fR exists.
.TP
.BI \-f \ file
True if \fIfile\fR exists and is a regular file.
.TP
.BI \-h \ file
True if \fIfile\fR exists and is a symbolic link.
.TP
.BI \-r \ file
True if \fIfile\fR exists and is readable.
.TP
.BI \-s \ file
True if \fIfile\fR exists and has a size greater than zero bytes.
.TP
.BI \-t \ fildes
True if the file whose file descriptor number is
.I fildes
is open and associated with a terminal device.
.I Fildes
must be a decimal digit (0 \- 9).
.TP
.BI \-w \ file
True if \fIfile\fR exists and is writable.
.TP
.BI \-x \ file
True if \fIfile\fR exists and is executable,
or if \fIfile\fR is a searchable directory.
.TP
.IB file1 \ \-ef \ file2
True if \fIfile1\fR and \fIfile2\fR both exist and refer
to the same file (same device, same inode).
.TP
.IB file1 \ \-nt \ file2
True if \fIfile1\fR and \fIfile2\fR both exist
and last data-modification time of \fIfile1\fR
is newer than that of \fIfile2\fR.
.TP
.IB file1 \ \-ot \ file2
True if \fIfile1\fR and \fIfile2\fR both exist
and last data-modification time of \fIfile1\fR
is older than that of \fIfile2\fR.
.TP
.IB s1 \ = \ s2
True if the strings
.I s1
and
.I s2
are equal.
.TP
.IB s1 \ != \ s2
True if the strings
.I s1
and
.I s2
are not equal.
.PP
These primaries may also be combined
with the following operators:
.TP 10
.BI ! \ expression
unary
.I negation
operator
.TP
.IB expression1 \ \-a \ expression2
binary
.I and
operator
.TP
.IB expression1 \ \-o \ expression2
binary
.I or
operator
.TP
.BI ( \ expression \ )
parentheses for grouping
.PP
.B \-a
has higher precedence than
.BR \-o .
Notice that all of the operators and flags
are separate arguments to
.IR if .
Notice also that parentheses are meaningful
to the shell and must be escaped.
.SH "EXIT STATUS"
The
.I if
command exits with one of the following values:
.TP
0
The expression was true (see below).
.TP
1
The expression was false or was not specified.
.TP
2
An error was detected.
.TP
125
The specified command was found
but did not begin with the proper
magic number or a `#!shell' sequence,
and a valid shell was not specified by
EXECSHELL
with which to execute it.
.TP
126
The specified command was found
but could not be executed.
.TP
127
The specified command was not found.
.PP
If the expression is true and if
.I command
is specified and executed,
the exit status is that of the executed
.IR command .
.SH ENVIRONMENT
Notice that the concept of `user environment'
was not defined in Sixth Edition UNIX.
Thus,
use of the following environment variables
by this port of the conditional command is an enhancement:
.TP
.B EXECSHELL
If set to a non-empty string,
the value of this variable is taken as the
path name of the shell which is invoked to
execute the specified command when it does not
begin with the proper magic number
or a `#!shell' sequence.
.TP
.B PATH
If set to a non-empty string,
the value of this variable is taken as the
sequence of directories which is used to
search for the specified command.
Notice that the
conditional command from Sixth Edition UNIX
always used the equivalent of `.:/bin:/usr/bin',
not PATH.
.SH "SEE ALSO"
goto(1),
osh(1),
sh6(1),
test(1)
.PP
Osh home page:
http://v6shell.org/
.SH COMPATIBILITY
The
.I if
command from Sixth Edition UNIX
does not support the
.BR \-d ,
.BR \-e ,
.BR \-f ,
.BR \-h ,
.BR \-s ,
.BR \-t ,
.BR \-x ,
.BR \-ef ,
.BR \-nt ,
and
.B \-ot
operators.
.PP
In addition to supporting the above operators,
this port also differs from the original in that
the exit status returned varies according to whether
the expression is true or false,
as is the case with
.IR test (1).
.SH HISTORY
An
.I if
command
appeared as
.I /bin/if
in Third Edition UNIX.
.SH LICENSE
See either the LICENSE file which is distributed with
.I osh
or
http://v6shell.org/license/
for full details.
.SH COPYRIGHT
.nf
Copyright (c) 2004-2010
Jeffrey Allen Neitzel. All rights reserved.
 
Copyright (c) 2001-2002
Caldera International Inc. All rights reserved.
 
Copyright (c) 1985, 1989, 1991, 1993
The Regents of the University of California. All rights reserved.
.fi
 
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server