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

bug: environment differs inside try #153

Open
ezrizhu opened this issue Mar 21, 2024 · 1 comment
Open

bug: environment differs inside try #153

ezrizhu opened this issue Mar 21, 2024 · 1 comment
Assignees

Comments

@ezrizhu
Copy link
Collaborator

ezrizhu commented Mar 21, 2024

a

@ezrizhu ezrizhu self-assigned this Mar 21, 2024
@mgree
Copy link
Contributor

mgree commented Jun 16, 2024

Which side is the real env and which side is inside try?

Fixing $PWD and $OLDPWD is easy. Fixing $_ is trickier:

 : mgreenbe@hippogriff:~/try [configure-install] ; echo $_
bash
: mgreenbe@hippogriff:~/try [configure-install] ; _=flash
: mgreenbe@hippogriff:~/try [configure-install] ; echo $_

: mgreenbe@hippogriff:~/try [configure-install] ; _=flash bash -c 'echo hi $_'
hi /usr/bin/bash

Bash won't let you set $_, even in a local-assignment We might be able to trick it using env, as in /usr/bin/env _="$_" ...:

: mgreenbe@hippogriff:~/try [configure-install] ; env _=flash bash -c 'echo hi $_'
hi flash

@mgree mgree changed the title try env diff bug: environment differs inside try Jun 16, 2024
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