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

Bash "$#" treated as comment #355

Open
GoogleCodeExporter opened this issue Feb 20, 2016 · 1 comment
Open

Bash "$#" treated as comment #355

GoogleCodeExporter opened this issue Feb 20, 2016 · 1 comment

Comments

@GoogleCodeExporter
Copy link

Bash's "$#" variable contains the number of arguments.

What steps will reproduce the problem?
1. Try to prettify the included Bash code.

<pre class="lang-bash prettyprint-override"><code># This is a comment
while [[ $# -gt 0 ]]; do
    echo $1
    shift
done
</code></pre>

What is the expected output?  What do you see instead?

The "$#" should be treated as a single token.
Instead, the "#" in "$#" is treated as the start of a comment.

Attached: correct output in vim, incorrect output on StackExchange.


What version are you using?  On what browser?

Unsure; it's whatever Stack Exchange currently uses.
(Sorry!)
Link to JS file: 
https://meta.stackexchange.com/content/Js/prettify-full.en.js?v=37843da05c2b

I'm on Chrome 38.0.2125.111 (Official Build 290379) for Linux Mint (Ubuntu).


Please provide any additional information below.

Keywords: dollar hash, dollar octothorpe, dollar pound, dollar number.

Original issue reported on code.google.com by [email protected] on 29 Oct 2014 at 4:36

Attachments:

@GoogleCodeExporter
Copy link
Author

Here's the other attachment (sorry).

Original comment by [email protected] on 29 Oct 2014 at 4:37

Attachments:

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

No branches or pull requests

1 participant