Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

type: add example #12668

Merged
merged 8 commits into from Apr 28, 2024
Merged

Conversation

fazlearefin
Copy link
Member

@fazlearefin fazlearefin commented Apr 23, 2024

  • The page(s) are in the correct platform directories: common, linux, osx, windows, sunos, android, etc.
  • The page(s) have at most 8 examples.
  • The page description(s) have links to documentation or a homepage.
  • The page(s) follow the content guidelines.
  • The PR title conforms to the recommended templates.
  • Version of the command being documented (if known):

@github-actions github-actions bot added the page edit Changes to an existing page(s). label Apr 23, 2024
Copy link
Member

@kbdharun kbdharun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thanks for your contribution.

@jimmychang851129
Copy link
Contributor

Quick question.
I am using OSX, and it shows bad option for "-t".
Does the option works in all platform?

Thanks

@fazlearefin
Copy link
Member Author

fazlearefin commented Apr 23, 2024

Quick question. I am using OSX, and it shows bad option for "-t". Does the option works in all platform?

Thanks

Looks like it works in bash only. In OSX, your default shell is most likely zsh. I will add a note to the example.

Thanks for reporting this.

pages/common/type.md Outdated Show resolved Hide resolved
Co-authored-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>
Copy link
Member

@vitorhcl vitorhcl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution, LGTM after my suggestion

pages/common/type.md Outdated Show resolved Hide resolved
Co-authored-by: Vítor Henrique <87824454+vitorhcl@users.noreply.github.com>
Copy link
Member

@vitorhcl vitorhcl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fazlearefin could you add the same note (Bash note) in the other examples, please? The POSIX has no options.

LGTM after this fix.

@fazlearefin
Copy link
Member Author

fazlearefin commented Apr 27, 2024

@fazlearefin could you add the same note (Bash note) in the other examples, please? The POSIX has no options.

LGTM after this fix.

@vitorhcl The other examples do no need the note as they work in both Bash and Zsh. The new example I added works in Bash only. Here are some screendumps:

Zsh

pop-os# ps -p $$
    PID TTY          TIME CMD
1726216 pts/9    00:00:00 zsh
pop-os#
pop-os# zsh --version
zsh 5.8.1 (x86_64-ubuntu-linux-gnu)
pop-os#
pop-os# type ls
ls is /usr/bin/ls
pop-os#
pop-os# type -a ls
ls is /usr/bin/ls
ls is /bin/ls
pop-os#
pop-os# type -p ls
ls is /usr/bin/ls
pop-os#
pop-os# type -t ls
type: bad option: -t
pop-os#
pop-os#

Bash

pop-os:~$ ps -p $$
    PID TTY          TIME CMD
1790148 pts/11   00:00:00 bash
pop-os:~$
pop-os:~$ bash --version
GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
pop-os:~$
pop-os:~$ type ls
ls is /usr/bin/ls
pop-os:~$
pop-os:~$ type -a ls
ls is /usr/bin/ls
ls is /bin/ls
pop-os:~$
pop-os:~$ type -p ls
/usr/bin/ls
pop-os:~$
pop-os:~$ type -t ls
file
pop-os:~$

@kbdharun kbdharun requested a review from vitorhcl April 27, 2024 06:15
@vitorhcl
Copy link
Member

The other examples do no need the note as they work in both Bash and Zsh. The new example I added works in Bash only. [...]

Thank you for showing me this.

Anyways, could you please add a note on these examples that only work on Bash and Zsh? I've consulted the documentation of all BSDs and all their default shells strictly follow the POSIX standard for the type command. tcsh doesn't even have type available.

@fazlearefin
Copy link
Member Author

Anyways, could you please add a note on these examples that only work on Bash and Zsh? I've consulted the documentation of all BSDs and all their default shells strictly follow the POSIX standard for the type command. tcsh doesn't even have type available.

Adding the note to all examples is too repetitive IMO. How about adding a note at the top of the page saying these commands work in Bash, Fish and Zsh shells only (BTW I tried in Fish shell and all of them worked)?

@vitorhcl
Copy link
Member

Let's just be sure to make clear, even if implicitly, that POSIX only supports the no options example.

@fazlearefin
Copy link
Member Author

Let's just be sure to make clear, even if implicitly, that POSIX only supports the no options example.

Done.

pages/common/type.md Outdated Show resolved Hide resolved
pages/common/type.md Outdated Show resolved Hide resolved
fazlearefin and others added 2 commits April 28, 2024 16:33
Co-authored-by: Sebastiaan Speck <12570668+sebastiaanspeck@users.noreply.github.com>
Co-authored-by: Sebastiaan Speck <12570668+sebastiaanspeck@users.noreply.github.com>
@sebastiaanspeck sebastiaanspeck merged commit 134df43 into tldr-pages:main Apr 28, 2024
4 checks passed
@fazlearefin fazlearefin deleted the feature/type-add-example branch April 28, 2024 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
page edit Changes to an existing page(s).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants