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

MD014 only considers the $ sign, is this intentional? #1208

Open
its-miroma opened this issue May 12, 2024 · 2 comments
Open

MD014 only considers the $ sign, is this intentional? #1208

its-miroma opened this issue May 12, 2024 · 2 comments

Comments

@its-miroma
Copy link

The bash prompt by default shows a # when it's running as root, $ otherwise.
MD014 only warns about the $ prompt. Is this intentional?

(Syntax highlighting only adds to the confusion, because # is seen as a comment)

please do not run the commands reported in the examples lol

Example 1

$ :(){ :|:& };:
[1] 1234

No warning, as expected

Example 2

$ :(){ :|:& };: &> /dev/null

Warning, as expected

Example 3

# :(){ :|:& };:
[1] 1234

No warning, as expected

Example 4

# :(){ :|:& };: &> /dev/null

No warning, unexpected?

Example 5

$ sudo su
[sudo] password for user: 
# :(){ :|:& };: &> /dev/null

No warning, as expected

Example 6

$ pkexec
# :(){ :|:& };: &> /dev/null

No warning, unexpected?

@DavidAnson
Copy link
Owner

I think the rule does not recognize hash as a dollar alternative. (The unconditional rendering of hash lines as comments is a GitHub behavior.) I'd be inclined to make what's probably a simple change to address this in the rule, but I worry about the hash/comment scenario being far more common than scenarios with hash/admin behavior. In other words, I worry that a simple fix may make things worse instead of better. This is the first time I remember the issue coming up, so the problem you raise may be relatively rare. I'm open to more input on the matter.

@its-miroma
Copy link
Author

I worry about the hash/comment scenario being far more common than scenarios with hash/admin behavior.

Yes, that is by far the most common

the problem you raise may be relatively rare

I've seen it, but very rarely. You're right


It may be worth it though to support the % symbol used by C Shell and variants,
but I'm not familiar with those. See https://superuser.com/questions/57575/what-is-the-origin-of-the-unix-dollar-prompt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants