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

read is perfectly happy to take a read-only variable #9346

Closed
floam opened this issue Nov 12, 2022 · 2 comments
Closed

read is perfectly happy to take a read-only variable #9346

floam opened this issue Nov 12, 2022 · 2 comments
Labels
bug Something that's not working as intended
Milestone

Comments

@floam
Copy link
Member

floam commented Nov 12, 2022

~> echo xx | read version
~> echo $status
0
~> echo $version
3.5.1-614-gdcf6ed94f-dirty
@floam floam added the bug Something that's not working as intended label Nov 12, 2022
@floam floam added this to the fish-future milestone Nov 12, 2022
@faho faho closed this as completed in dad8c52 Jan 13, 2023
@faho faho modified the milestones: fish-future, fish 3.6.1 Jan 13, 2023
@ammgws
Copy link
Contributor

ammgws commented Mar 27, 2023

Is there a list of these read-only variables somewhere? I know $status and $version, and $hostname seems to be one too (

#CHECKERR: {{.*}}loops.fish (line {{\d+}}): for: hostname: cannot overwrite read-only variable
), but apparently _ is one as well:

>echo meow | read _
read: _: cannot overwrite read-only variable

@ammgws
Copy link
Contributor

ammgws commented Mar 27, 2023

Got it... perhaps should be documented?

>set --show | rg read-only
$FISH_VERSION: set in global scope, unexported, with 1 elements (read-only)
$PWD: set in global scope, exported, with 1 elements (read-only)
$SHLVL: set in global scope, exported, with 1 elements (read-only)
$_: set in global scope, unexported, with 1 elements (read-only)
$fish_kill_signal: set in global scope, unexported, with 1 elements (read-only)
$fish_killring: set in global scope, unexported, with 0 elements (read-only)
$fish_pid: set in global scope, unexported, with 1 elements (read-only)
$hostname: set in global scope, unexported, with 1 elements (read-only)
$pipestatus: set in global scope, unexported, with 1 elements (read-only)
$status: set in global scope, unexported, with 1 elements (read-only)
$status_generation: set in global scope, unexported, with 1 elements (read-only)
$version: set in global scope, unexported, with 1 elements (read-only)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that's not working as intended
Projects
None yet
Development

No branches or pull requests

3 participants