Re: Using the bash shell: determine if the root user used 'sudo -i'
On Sat, Aug 26, 2023 at 06:42:42PM -0400, Karl Vogel wrote:
> If you're running bash, the safest way to find your current working
> directory is capturing the output from /bin/pwd. Symlinked directories
> can surprise you:
>
> me$ cd
>
> me$ ls -ldF today
> lrwxr-xr-x 1 me mis 18 Aug 26 00:03 today@ -> notebook/2023/0826
>
> me$ cd today
>
> me$ pwd
> /home/me/today
>
> me$ /bin/pwd
> /home/me/notebook/2023/0826
>
> me$ echo $PWD
> /home/me/today
unicorn:~$ help pwd
pwd: pwd [-LP]
Print the name of the current working directory.
Options:
-L print the value of $PWD if it names the current working
directory
-P print the physical directory, without any symbolic links
By default, `pwd' behaves as if `-L' were specified.
[...]
Of course, this is all a big tangent from the original request.
Reply to: