multitudes / 42-minishell

This project is about creating a simple shell
MIT License
0 stars 0 forks source link

FEATURE REQUEST [when HOME unset] the cd ~ should still work like in bash #164

Open ProjektPhoenix opened 3 months ago

ProjektPhoenix commented 3 months ago

read HOME dir through

/usr/bin/getent passwd $UID | cut -d: -f6

the UID could be obtained through sig info or even easier: /usr/bin/id call to execve gives UID as first entry

multitudes commented 2 months ago

The equivalent in macOS

dscl . -read /Users/$(whoami) NFSHomeDirectory | awk '{print $2}'

(from copilot) The dscl (Directory Service command line) utility on macOS is used to interact with Directory Services. Directory Services is a system service in macOS that stores and manages information about users, groups, and other resources on the system. This includes user account details, such as user IDs, home directories, and group memberships.

The dscl command can query, create, and modify entries in the Directory Services database. It's commonly used for tasks such as:

A typical use of dscl to query the current user's home directory is as follows:

dscl . -read /Users/$(whoami) NFSHomeDirectory
multitudes commented 2 months ago

This is a nice to have but not crucial

ProjektPhoenix commented 2 months ago

I think it mostly works.