FDMOVE(1)
πΈ FDMOVE(1) πΈ
okay so bestie, you're reading the fdmove page from the General Commands Manual β yes, that General Commands Manual β and it's genuinely one of those tiny tools that eats. let me put you on π
β¨ NAME β¨
fdmove β move or copy a given file descriptor, then execute a program π«Ά
β¨ SYNOPSIS β¨
fdmove [-c] fdto fdfrom prog...
β¨ DESCRIPTION β¨
okay so here's the whole vibe: fdmove takes the file descriptor number fdfrom and moves it to number fdto, and then it exec(3)s into prog with its arguments. that's it. that's the whole personality. π
and like, important detail: if fdto is already open, fdmove closes it first, before it moves fdfrom onto it. no leftovers, no mess, we love a clean slate β¨
so fdmove a b prog... is roughly equivalent to this little number:
sh -c 'exec prog... a>&b b<&-'
which means β and stay with me here β if you write to fd a now, it'll have the exact same effect as writing to fd b beforehand. and you cannot write to fd b anymore. it's gone. moved out. no forwarding address π
and then fdmove -c a b prog... is roughly equivalent to:
sh -c 'exec prog... a>&b'
which means: you can now write to fd a, and you can also still write to fd b, and both of those do the same thing as writing to fd b beforehand. two doors, one room. iconic. π
and the plot twist?? it also works with file descriptors that are open for reading! not just writing! equal opportunity file descriptors fr fr π
β¨ OPTIONS β¨
-cβ duplicatefdfromtofdtoinstead of moving it; do not closefdfrom. basically keep the original around too, no cap π¦
β¨ SEE ALSO β¨
emptyenv(1), envfile(1), exec(1), execline-cd(1), execline-umask(1), exit(1), export(1), fdblock(1), fdclose(1), fdreserve(1), fdswap(1), getcwd(1), getpid(1), heredoc(1), piperw(1), posix-cd(1), posix-umask(1), redirfd(1), trap(1), tryexec(1), unexport(1), wait(1), withstdinas(1), exec(3)
this man page is ported from the authoritative documentation at: https://skarnet.org/software/execline/fdmove.html β go check the source bestie, it's giving credibility π
β¨ AUTHORS β¨
- Laurent Bercot
- Alexis <flexibeast@gmail.com> (man page port)
and that's the whole page, bestie! π this one's from Debian, dated February 16, 2021, and it's the FDMOVE(1) page β go move some file descriptors, you're gonna slay π§βπ₯
π¦ where this page comes from
- nixpkgs unstable: execline 2.9.9.2
- nixpkgs unstable: execline-man-pages 2.9.9.1.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms