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

Document no clobber redirection support #2812

Closed
ijanos opened this issue Mar 11, 2016 · 9 comments

Comments

@ijanos
Copy link

commented Mar 11, 2016

noclobber is a feature available in bash and zsh, that prevents existing files being overwritten with the > operator.

I think this a great ergonomic feature and it fits nicely into the mindset of fish shell. And I think it should be enabled by default.

@krader1961

This comment has been minimized.

Copy link
Contributor

commented Mar 11, 2016

I vote no but let's see what others think. The one time I tried the feature long ago I found it more annoying than helpful. I found myself using the override syntax after a couple of days which caused me to disable the feature. Too, the philosophy of fish is to avoid configurable behaviors such as this unless there is a truly compelling reason.

@ridiculousfish

This comment has been minimized.

Copy link
Member

commented Mar 11, 2016

fish already has this. echo foo >? file.txt is a no-clobber redirection.

@ridiculousfish

This comment has been minimized.

Copy link
Member

commented Mar 11, 2016

It looks like this was never documented.

@ridiculousfish ridiculousfish added docs and removed enhancement labels Mar 11, 2016
@ridiculousfish ridiculousfish added this to the fish-future milestone Mar 11, 2016
@ridiculousfish ridiculousfish changed the title feature request: add noclobber support Document no clobber redirection support Mar 11, 2016
@ijanos

This comment has been minimized.

Copy link
Author

commented Mar 12, 2016

Is there a way to make it default?

@ridiculousfish

This comment has been minimized.

Copy link
Member

commented Mar 12, 2016

No way! That would violate fish's no-configuration principle, plus probably break a lot of provided functions.

@ijanos

This comment has been minimized.

Copy link
Author

commented Mar 12, 2016

Maybe I wasn't clear. Can I create something similar to an alias or user-defined function that will use >? when I type > in the interactive shell?

@rumpelsepp

This comment has been minimized.

Copy link

commented Mar 12, 2016

@floam

This comment has been minimized.

Copy link
Member

commented Mar 12, 2016

abbr.fish:

        # ensure the key contains at least one non-space character
        if not string match -qr "\w" -- $key
            printf ( _ "%s: abbreviation must have a non-empty key\n" ) abbr >&2

It's not going to match a suitable key and value to change the behavior how he wants, for starters. Are you suggesting if that were bypassed that can actually work? I haven't looked at how this is implemented. That would certainly make things interesting.

@zanchey

This comment has been minimized.

Copy link
Member

commented May 21, 2016

Abbreviations can use non-string keys but they're not expanded except in the command position.

@faho faho closed this in dc470bc May 23, 2016
@zanchey zanchey modified the milestones: next-2.x, fish-future May 23, 2016
@faho faho modified the milestones: fish 2.4.0, next-2.x Sep 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants
You can’t perform that action at this time.