On Sat, Aug 26, 2023 at 11:56:27AM -0400, Greg Wooledge wrote: > On Sat, Aug 26, 2023 at 10:49:45AM -0500, Tom Browder wrote: > > I would like to know whether 'sudo -i' or 'sudo -s' was used. > > That's STILL an X-Y problem. > > > The reason is > > to know if the cwd is set to '/root' or '.' It's critical for the script > > execution > > Oh? Then just look at the current working directory. It's in the $PWD > variable.
I guess it's better use the shell builtin pwd: PWD=/not/such/file/or/directory echo "cwd=" $(pwd) "PWD=" $PWD (Note: your shell prompt might be a bit... messed up after that) > You don't actually need to know what was typed. Yep, that was my hunch, too. Cheers -- t
signature.asc
Description: PGP signature