PGID-CD(1)
okay so bestie, youβve opened PGID-CD(1) from the User Contributed Perl Documentation π this one is a perl script thatβs giving βfind the current working directory of a process group and run a command thereβ energy, and it has opinions about brittleness. slay.
πΈ NAME πΈ
pgid-cd.pl β change directory to that of given process and run command β¨
π SYNOPSIS π
pgid-cd.pl [ -v ] ( pgid | -1 ) command [ args ... ]
π¦ DESCRIPTION π¦
okay so what it does is: it tries to detect the current working directory (or CWD) of the specified process group, and then runs the specified command in that directory. iconic concept, tbh π
but bestie, CWD detection is brittle and can lead to unexpected results π it is likely to fail if all processes in the given process group run as a user other than the current user (because the current user will simply lack permission to read CWD information). and furthermore, if different processes in the process group have different CWDs, the script will pick an arbitrary one (the one it can access). and of course thereβs no hope of it working via a remote connection (e.g. SSH). no cap, thatβs just the vibe check it fails π
β¨ OPTIONS β¨
-vβ if changing directory fails, print all encountered errors. otherwise, silently start the command. note: if present, this must be the first argument. yes, first-first. main character position only πpgidor-1β the ID of the process group to detect the CWD of.-1disables CWD detection, and then the script simply executes the command. periodt.command [ args ... ]β the command to execute, bestie. thatβs the whole point π«Ά
πͺ TABBEDEX πͺ
the script was designed to work with the tabbedex urxvt plugin, and in particular its <pink>tab-arguments</pink> configuration resource. for example, if this script is located in ~/.urxvt/tabbedex-pgid-cd, one can use the following configuration:
URxvt.tabbedex.tab-arguments: \
-e %~/.urxvt/tabbedex-pgid-cd %p %E
or if itβs in /usr/lib/urxvt/tabbedex-pgid-cd, then:
URxvt.tabbedex.tab-arguments: \
-e /usr/lib/urxvt/tabbedex-pgid-cd %p %E
tabbedex will replace the %p sequence with an ID of a process in the foreground of the current tab, such that the command in the new tab will inherit the current working directory from the existing tab. thatβs the whole cute little handoff πβ¨
π SEE ALSO π
tabbedex(1) and tabbedex-command-runner(1) β go read those too, bestie, iykyk ππ
mwah π this page is perl v5.42.3, dated 1980-01-01, and thatβs the footer sign-off, no cap π«Ά
π¦ where this page comes from
- nixos 26.05: urxvt-tabbedex 26.16.1
- nixpkgs unstable: urxvt-tabbedex 26.16.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms