1runat(1) User Commands runat(1)
2
3
4
6 runat - execute command in extended attribute name space
7
9 /usr/bin/runat file [command]
10
11
13 The runat utility is used to execute shell commands in a file's hidden
14 attribute directory. Effectively, this utility changes the current
15 working directory to be the hidden attribute directory associated with
16 the file argument and then executes the specified command in the bourne
17 shell (/bin/sh). If no command argument is provided, an interactive
18 shell is spawned. The environment variable $SHELL defines the shell to
19 be spawned. If this variable is undefined, the default shell, /bin/sh,
20 is used.
21
22
23 The file argument can be any file, including a directory, that can sup‐
24 port extended attributes. It is not necessary that this file have any
25 attributes, or be prepared in any way, before invoking the runat com‐
26 mand.
27
29 The following operands are supported:
30
31 file Any file, including a directory, that can support extended
32 attributes.
33
34
35 command The command to be executed in an attribute directory.
36
37
39 A non-zero exit status will be returned if runat cannot access the file
40 argument, or the file argument does not support extended attributes.
41
43 See fsattr(5) for a detailed description of extended file attributes.
44
45
46 The process context created by the runat command has its current work‐
47 ing directory set to the hidden directory containing the file's
48 extended attributes. The parent of this directory (the ".." entry)
49 always refers to the file provided on the command line. As such, it may
50 not be a directory. Therefore, commands (such as pwd) that depend upon
51 the parent entry being well-formed (that is, referring to a directory)
52 may fail.
53
54
55 In the absence of the command argument, runat will spawn a new interac‐
56 tive shell with its current working directory set to be the provided
57 file's hidden attribute directory. Notice that some shells (such as zsh
58 and tcsh) are not well behaved when the directory parent is not a
59 directory, as described above. These shells should not be used with
60 runat.
61
63 Example 1 Using runat to list extended attributes on a file
64
65 example% runat file.1 ls -l
66 example% runat file.1 ls
67
68
69
70 Example 2 Creating extended attributes
71
72 example% runat file.2 cp /tmp/attrdata attr.1
73 example% runat file.2 cat /tmp/attrdata > attr.1
74
75
76
77 Example 3 Copying an attribute from one file to another
78
79 example% runat file.2 cat attr.1 | runat file.1 "cat > attr.1"
80
81
82
83 Example 4 Using runat to spawn an interactive shell
84
85 example% runat file.3 /bin/sh
86
87
88
89
90 This spawns a new shell in the attribute directory for file.3. Notice
91 that the shell will not be able to determine what your current direc‐
92 tory is. To leave the attribute directory, either exit the spawned
93 shell or change directory (cd) using an absolute path.
94
95
96
97 Recommended methods for performing basic attribute operations:
98
99
100 display runat file ls [options]
101
102
103 read runat file cat attribute
104
105
106 create/modify runat file cp absolute-file-path attribute
107
108
109 delete runat file rm attribute
110
111
112 permission changes
113 runat file chmod mode attribute
114 runat file chgrp group attribute
115 runat file chown owner attribute
116
117
118
119
120 interactive shell
121 runat file /bin/sh or set your $SHELL to /bin/sh and runat file
122
123
124
125
126 The above list includes commands that are known to work with runat.
127 While many other commands may work, there is no guarantee that any
128 beyond this list will work. Any command that relies on being able to
129 determine its current working directory is likely to fail. Examples of
130 such commands follow:
131
132 Example 5 Using man in an attribute directory
133
134 example% runat file.1 man runat
135 >getcwd: Not a directory
136
137
138
139 Example 6 Spawning a tcsh shell in an attribute directory
140
141 example% runat file.3 /usr/bin/tcsh
142 tcsh: Not a directory
143 tcsh: Trying to start from "/home/user"
144
145
146
147
148 A new tcsh shell has been spawned with the current working directory
149 set to the user's home directory.
150
151
152 Example 7 Spawning a zsh shell in an attribute directory
153
154 example% runat file.3 /usr/bin/zsh
155 example%
156
157
158
159
160 While the command appears to have worked, zsh has actually just changed
161 the current working directory to '/'. This can be seen by using
162 /bin/pwd:
163
164
165 example% /bin/pwd
166 /
167
168
169
171 SHELL Specifies the command shell to be invoked by runat.
172
173
175 The following exit values are returned:
176
177 125 The attribute directory of the file referenced by the file
178 argument cannot be accessed.
179
180
181 126 The exec of the provided command argument failed.
182
183
184
185 Otherwise, the exit status returned is the exit status of the shell
186 invoked to execute the provided command.
187
189 See attributes(5) for descriptions of the following attributes:
190
191
192
193
194 ┌─────────────────────────────┬─────────────────────────────┐
195 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
196 ├─────────────────────────────┼─────────────────────────────┤
197 │Availability │SUNWcsu │
198 ├─────────────────────────────┼─────────────────────────────┤
199 │CSI │Enabled │
200 ├─────────────────────────────┼─────────────────────────────┤
201 │Interface Stability │Evolving │
202 └─────────────────────────────┴─────────────────────────────┘
203
205 open(2), attributes(5), fsattr(5)
206
208 It is not always obvious why a command fails in runat when it is unable
209 to determine the current working directory. The errors resulting can be
210 confusing and ambiguous (see the tcsh and zsh examples above).
211
212
213
214SunOS 5.11 22 Jun 2001 runat(1)