pwd(3tcl)

πŸ“¦
version 9.0.4 Β· 2 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ pwd β€” bestie edition πŸ’–

ok so real quick, this is a page from the Tcl Built-In Commands manual, section 3tcl, and it's about the iconic lil command called pwd. yeah. the one you already know. let's get into it 🫢


🌸 NAME 🌸

pwd β€” returns the absolute path of the current working directory. that's it. that's the whole vibe check. πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

pwd

no args. no flags. no drama. just pwd and go ✨


πŸ’œ DESCRIPTION πŸ’œ

okay so pwd returns the absolute path name of the current working directory. like, the whole entire path, from the root, no shortcuts, no relative nonsense. where you actually ARE. main character energy fr fr πŸ‘‘


🌈 EXAMPLE 🌈

ngl this is a good one, bestie, pay attention 😭

so sometimes it's genuinely useful to dip into a known directory when you're running some external command with exec β€” but here's the thing, it's also important to keep the app usually running in the directory it was started in (unless the user says otherwise, obviously) because that minimizes user confusion. nobody wants chaos. we hate chaos. πŸ™ˆ

and the way you do this is you save the current directory while the external command is doing its thing:

set tarFile [file normalize somefile.tar]
set savedDir [pwd]
cd /tmp
exec tar -xf $tarFile
cd $savedDir

see?? you grab pwd first, shove it in savedDir, go do your little cd /tmp moment, run the exec, and then cd $savedDir right back home like nothing ever happened. chef's kiss. ate. πŸ”₯


πŸ¦‹ SEE ALSO πŸ¦‹

go read those too, iykyk πŸ’–


⭐ KEYWORDS ⭐

  • working directory

ok that's the whole page, you're officially a pwd expert, no cap πŸ’…βœ¨ this was the Tcl pwd(3tcl) page bestie, sending you love and absolute paths πŸŽ€πŸ«ΆπŸ’œ

πŸ“¦ where this page comes from