xref: /freebsd/usr.bin/runat/runat.1 (revision ee3960cba1068e12fb032a68c46d74841d9edab3)
1.\"
2.\" Copyright (c) 2025 Rick Macklem
3.\"
4.\" SPDX-License-Identifier: BSD-2-Clause
5.\"
6.Dd April 15, 2025
7.Dt RUNAT 1
8.Os
9.Sh NAME
10.Nm runat
11.Nd run a shell command on a named attribute directory
12.Sh SYNOPSIS
13.Nm
14.Op Ar file
15.Op Ar shell command
16.Sh DESCRIPTION
17The
18.Nm
19utility runs the shell command on the named attribute directory for the
20.Ar file
21argument.
22It does a
23.Xr fchdir 2
24system call to change the current working directory into the
25named attribute directory for the
26.Ar file
27argument and then performs the shell command via
28.Xr sh 1 .
29.Pp
30If a named attribute directory does not exist for
31.Ar file ,
32an empty one will be created.
33If an application needs to determine if a named attribute
34exists for the
35.Ar file ,
36.Xr pathconf 2
37with the name
38.Fa _PC_HAS_NAMEDATTR
39may be used.
40This will not create an empty named attribute directory
41if one does not exist for
42.Ar file .
43.Sh EXAMPLES
44For a
45.Ar file
46called
47.Dq myfile :
48.Bd -literal
49$ runat myfile ls -l			# lists the attributes for myfile
50$ runat myfile cp /etc/hosts attrhosts	# creates attrhosts
51$ runat myfile cat attrhosts		# displays contents of attrhosts
52.Ed
53.Sh SEE ALSO
54.Xr sh 1 ,
55.Xr fchdir 2 ,
56.Xr pathconf 2 ,
57.Xr open 2 ,
58.Xr named_attribute 7
59.Sh HISTORY
60The
61.Nm
62utility first appeared in
63.Fx 15.0 .
64