aspnet / dnvm

OBSOLETE - see readme
Other
174 stars 61 forks source link

dnvm alias allows updating existing alias if noclobber is set #427

Closed bjorkstromm closed 9 years ago

bjorkstromm commented 9 years ago

Fixes #423

@anurse would it be beneficial to run all tests with noclobber option?

Accoring to the Unix Power Tools Book the Z shell understands both !and |, therefore I'm not using any shell checking in dnvm.sh

Regarding checking current shell, unlike the original PR, I'm not checking $SHELL variable as this will only return default shell, therefore checking $BASH_VERSION or $ZSH_VERSION would be more safe.

analogrelay commented 9 years ago

We need to get automated tests using dash, since that's the default shell in Ubuntu...

Until then, do you have access to a Ubuntu machine (or other machine with dash installed) to give it a quick try there and make sure >| works in dash?

Otherwise, looks good to me! Thanks! /cc @BrennanConroy

bjorkstromm commented 9 years ago

According to manual, dash uses >|

[n]> file   Redirect standard output (or n) to file.
[n]>| file  Same, but override the -C option.

Also verified on my own computer:

$ touch foobar
$ dash -C -c "echo 'foobar' > foobar"
dash: 1: cannot create foobar: File exists
$ dash -C -c "echo 'foobar' >| foobar"
$ cat foobar
foobar
muratg commented 9 years ago

Looks good to me. :shipit: @BrennanConroy, could you take it in?