xtyrrell / undollar

undollar eats the dollar sign in the command you just pasted into your terminal
MIT License
165 stars 4 forks source link

Add support for different shell prompt characters #1

Open xtyrrell opened 5 years ago

xtyrrell commented 5 years ago

Add support for undollar to 'eat' different shell prompt characters such as and '%' and '#' (though this may warrant a confirmation prompt because it represents a superuser).

cstobey commented 5 years ago

This whole program (with installation) could be reduced to this bash oneliner:

echo '"$@"' >/usr/local/bin/$ ; chmod +x /usr/local/bin/$

You could do the same with any special character you wanted.

xtyrrell commented 5 years ago

You're absolutely right. This would work in the vast majority of cases. It is definitely kind of crazy to spin up an entire JavaScript virtual machine just to pass on a command to the system, and it does feel pretty gross doing so.

That being said, the number one priority for this project is that it is extremely easy for anyone to use, including across operating systems and shells. What you've given is a great base, and I am probably going to use it to replace the JavaScript with an installation shell script that handles permissions and offers uninstallation across operating systems as easily for users as it is with npm.

Thank you!

jocap commented 5 years ago

Here you go:

#!/bin/sh
exec "$@"

This works with signals and everything.