Your results do not match your command so I'm not really trusting the results that you wrote into the question. In particular /LOG/ is left off of your results.
e.g.
sudo -i ls -ld /var/folx*
ls: /var/folx*: No such file or directory
I don't know which sudo you are using because AIX does not come with a sudo command. But I'm using the man page from my Mac.
-i [command]
The -i (simulate initial login) option runs the shell
specified in the passwd(5) entry of the target user as a
login shell. This means that login-specific resource files
such as .profile or .login will be read by the shell. If a
command is specified, it is passed to the shell for
execution. Otherwise, an interactive shell is executed.
sudo attempts to change to that user's home directory
before running the shell. It also initializes the
environment, leaving DISPLAY and TERM unchanged, setting
HOME, MAIL, SHELL, USER, LOGNAME, and PATH, as well as the
contents of /etc/environment on Linux and AIX systems. All
other environment variables are removed.
Note the phrase " to change to that user's home directory". It appears that it does the cd to home even when a command is given.
sudo pwd
/private/tmp
sudo -i pwd
/private/var/root
Here are some methods to try and debug this type of situation yourself. First is to replace your command with just env
and capture the output in two separate files and then compare them. See if any differences might be the root of the issue. Second, pwd
as I did and you discover that your current working directory is changing while in the sudo context. The third item which doesn't apply in this case but does in other cases is to do echo *
as the command. In this case, it would have given you a clue but probably still might have been really confusing.
The other part is notice that -i is sucking up .profile and .login. Many users goof up their .profile and .login files by assuming various things. So, the other item that you might need to do sometimes is put set -x
at the top of your .profile to see what it is doing. In this case, that was not needed.