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

[Feature]: Implement special environment variables like $? #484

Open
MrPicklePinosaur opened this issue Jun 8, 2024 · 2 comments
Open
Labels
enhancement New feature or request

Comments

@MrPicklePinosaur
Copy link
Owner

What would you like to see added?

@dmgolembiowski
Copy link

These are some really useful ones from different shells:

!! # Bash: Repeat the previous command but prompting with `sudo` 
$argv # fish: (self-explanatory)
$* # Bash: $argv, but as a plain ascii string slice

Personally speaking, I'd love to see the first two make a comeback. My bashrc used to have:
run() { ( $* &> /dev/null ) & } so strategically there are fair reasons to want $* as well.

Something that would be a novel shell environment variable introduction would be a lazily evaluated $. which resolves to an iterator over all (non self directory and parent directory) canonicalized file paths. This lends itself nicely to shell invocations like for file in $.; do ... done

Another curious environment variable is the $$ for the process pid. In terms of debugging custom shells, it would be nice if there existed a $SHRS environment variable that resolves to a unix domain socket path for debugging, background job management, sourcing new logins, etc.

I'd like to toy around with the idea of $ being lazily evaluated to one before the previous command.

@MrPicklePinosaur
Copy link
Owner Author

$SHRS as an env var is quite an interesting idea!

We are currently pretty short on dev time, but i'll keep reviewing any PRs :)

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

No branches or pull requests

2 participants