2 .\" Portions Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH RUNAT 1 "Jun 22, 2001"
8 runat \- execute command in extended attribute name space
12 \fB/usr/bin/runat\fR \fIfile\fR [\fIcommand\fR]
18 The \fBrunat\fR utility is used to execute shell commands in a file's hidden
19 attribute directory. Effectively, this utility changes the current working
20 directory to be the hidden attribute directory associated with the file
21 argument and then executes the specified command in the bourne shell
22 (\fB/bin/sh\fR). If no command argument is provided, an interactive shell is
23 spawned. The environment variable $\fBSHELL\fR defines the shell to be spawned.
24 If this variable is undefined, the default shell, \fB/bin/sh\fR, is used.
27 The file argument can be any file, including a directory, that can support
28 extended attributes. It is not necessary that this file have any attributes, or
29 be prepared in any way, before invoking the \fBrunat\fR command.
33 The following operands are supported:
40 Any file, including a directory, that can support extended attributes.
49 The command to be executed in an attribute directory.
55 A non-zero exit status will be returned if \fBrunat\fR cannot access the
56 \fIfile\fR argument, or the \fIfile\fR argument does not support extended
61 See \fBfsattr\fR(5) for a detailed description of extended file attributes.
64 The process context created by the \fBrunat\fR command has its current working
65 directory set to the hidden directory containing the file's extended
66 attributes. The parent of this directory (the "\fB\&..\fR" entry) always refers
67 to the file provided on the command line. As such, it may not be a directory.
68 Therefore, commands (such as \fBpwd\fR) that depend upon the parent entry being
69 well-formed (that is, referring to a directory) may fail.
72 In the absence of the \fIcommand\fR argument, \fBrunat\fR will spawn a new
73 interactive shell with its current working directory set to be the provided
74 file's hidden attribute directory. Notice that some shells (such as \fBzsh\fR
75 and \fBtcsh\fR) are not well behaved when the directory parent is not a
76 directory, as described above. These shells should not be used with
80 \fBExample 1 \fRUsing runat to list extended attributes on a file
84 example% \fBrunat file.1 ls -l\fR
85 example% \fBrunat file.1 ls\fR
91 \fBExample 2 \fRCreating extended attributes
95 example% \fBrunat file.2 cp /tmp/attrdata attr.1\fR
96 example% \fBrunat file.2 cat /tmp/attrdata > attr.1\fR
102 \fBExample 3 \fRCopying an attribute from one file to another
106 example% \fBrunat file.2 cat attr.1 | runat file.1 "cat > attr.1"\fR
112 \fBExample 4 \fRUsing runat to spawn an interactive shell
116 example% \fBrunat file.3 /bin/sh\fR
123 This spawns a new shell in the attribute directory for \fBfile.3\fR. Notice
124 that the shell will not be able to determine what your current directory is. To
125 leave the attribute directory, either exit the spawned shell or change
126 directory (\fBcd\fR) using an absolute path.
130 Recommended methods for performing basic attribute operations:
138 \fBrunat \fIfile\fR ls [\fIoptions\fR]\fR
147 \fBrunat \fIfile\fR cat \fIattribute\fR\fR
156 \fBrunat \fIfile\fR cp \fIabsolute-file-path\fR \fIattribute\fR\fR
165 \fBrunat \fIfile\fR rm \fIattribute\fR\fR
171 \fBpermission changes\fR
177 \fBrunat \fIfile\fR chmod \fImode attribute\fR
178 runat \fIfile\fR chgrp \fIgroup attribute\fR
179 runat \fIfile\fR chown \fIowner attribute\fR\fR
189 \fBinteractive shell\fR
194 \fBrunat \fIfile\fR /bin/sh\fR or set your $SHELL to /bin/sh and \fBrunat \fIfile\fR\fR
201 The above list includes commands that are known to work with \fBrunat\fR. While
202 many other commands may work, there is no guarantee that any beyond this list
203 will work. Any command that relies on being able to determine its current
204 working directory is likely to fail. Examples of such commands follow:
206 \fBExample 5 \fRUsing man in an attribute directory
210 example% \fBrunat file.1 man runat\fR
211 >getcwd: Not a directory
217 \fBExample 6 \fRSpawning a tcsh shell in an attribute directory
221 example% \fBrunat file.3 /usr/bin/tcsh\fR
222 tcsh: Not a directory
223 tcsh: Trying to start from "/home/\fIuser\fR"
230 A new tcsh shell has been spawned with the current working directory set to the
231 user's home directory.
234 \fBExample 7 \fRSpawning a zsh shell in an attribute directory
238 example% \fBrunat file.3 /usr/bin/zsh\fR
246 While the command appears to have worked, \fBzsh\fR has actually just changed
247 the current working directory to '/'. This can be seen by using \fB/bin/pwd\fR:
252 example% \fB/bin/pwd\fR
258 .SH ENVIRONMENT VARIABLES
265 Specifies the command shell to be invoked by \fBrunat\fR.
271 The following exit values are returned:
278 The attribute directory of the file referenced by the \fIfile\fR argument
288 The exec of the provided \fIcommand\fR argument failed.
293 Otherwise, the exit status returned is the exit status of the shell invoked to
294 execute the provided command.
298 See \fBattributes\fR(5) for descriptions of the following attributes:
306 ATTRIBUTE TYPE ATTRIBUTE VALUE
310 Interface Stability Evolving
316 \fBopen\fR(2), \fBattributes\fR(5), \fBfsattr\fR(5)
320 It is not always obvious why a command fails in \fBrunat\fR when it is unable
321 to determine the current working directory. The errors resulting can be
322 confusing and ambiguous (see the \fBtcsh\fR and \fBzsh\fR examples above).