LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   unknown bash command? (https://www.linuxquestions.org/questions/linux-newbie-8/unknown-bash-command-4175597577/)

fanoflq 01-16-2017 12:14 PM

unknown bash command?
 
unknown bash command?

I look at many places, but could not find
bash information for d, gn and un.

I saw this fragment for bash:
Code:

[ "`d -gn`“ : "‘`d -un`”
What are d, gn and un?
Thanks.

rtmistler 01-16-2017 12:21 PM

d is obviously an abbreviation for one bash command, and -gn -un are arguments it accepts.

I thought possibly "date", however it does not appear to have those arguments, or at least mine does not.

Any more details about how it is used?

Where did you get that from? Someone's script? Horrible script writer if so.

hydrurga 01-16-2017 01:07 PM

It looks as if it may have come from here (bottom answer): http://unix.stackexchange.com/questi...rs-under-linux

where it is:

Code:

[ "`id -gn`" = "`id -un`" ]

rtmistler 01-16-2017 01:11 PM

Excellent find hydrurga.

Well obviously it was misquoted or "found" somewhere else where it was already corrupted from it's original form.

fanoflq 01-16-2017 01:11 PM

Thank you for responding.....

Quote:

Originally Posted by rtmistler (Post 5655781)
d is obviously an abbreviation for one bash command, and -gn -un are arguments it accepts.

I thought possibly "date", however it does not appear to have those arguments, or at least mine does not.

Any more details about how it is used?

Where did you get that from? Someone's script? Horrible script writer if so.

It is from a RHCSA study guide book 7th edition, by Michael Jung.
Ops... I have to make corrections....

Excerpts:
Code:

The Default umask
With that in mind, the default umask is driven by the /etc/profile and /etc/bashrc
files, specifically the following stanza, which drives a value for umask depending on
the value of the UID:

if [ $UID -gt 199 ] && [ "`id -gn`“ = "‘`id -un`” ]; then
        umask 002
else
        umask 022
fi

In other words, the umask for user accounts with UIDs of 200 and above is 002.
In contrast, the umask for UIDs below 200 is 022. In RHEL 7, service users such as
adm, postfiX, and apache have lower UIDs; this affects primarily the permissions of
the log files created for such services. Of course, the root administrative user has
the lowest UID of 0. By default, files created for such users have 644 permissions;
directories created for such users have 755 permissions.

In contrast, regular users have a UID of 1000 and above. Files created by such
users normally have 664 permissions. Directories created by such users normally
have 775 permissions. Users can override the default settings by appending an
umask command in their ~/.bashrc or ~/.bash_profile.


The error on my part is "d" command should be "id" command.
Now I know what id is,.
I can now guess what gn and un are, i.e. group name and user name.
but I was not able to find it in bash documentation....

rtmistler 01-16-2017 01:12 PM

If that's really what the book quotes, then write to the publisher and inform them that they have an error.

Turbocapitalist 01-16-2017 01:16 PM

As for the pieces, the [ is like the program test. The backticks ` are command substitution and could better be written as $( … )

fanoflq 01-16-2017 01:17 PM

Sorry folks.
Please see corrections in original post.
Thank you.

rtmistler 01-16-2017 01:20 PM

Quote:

Originally Posted by fanoflq (Post 5655813)
Sorry folks.
Please see corrections in original post.
Thank you.

OK, it's not a publication error. The command is also no longer an unknown, you should be able to review the manual page to see that it is used to print user and group information.

Does this resolve you question?

fanoflq 01-16-2017 01:23 PM

!
 
Quote:

Originally Posted by rtmistler (Post 5655815)
OK, it's not a publication error. The command is also no longer an unknown, you should be able to review the manual page to see that it is used to print user and group information.

Does this resolve you question?

Thank you.
I found the answer in here: man id


All times are GMT -5. The time now is 06:15 PM.