-
Notifications
You must be signed in to change notification settings - Fork 294
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
run a script on the shell with sudo #18
Comments
I'm not 100% sure what exactly you're asking, so correct me if I'm wrong. It sounds like you want to run some interactive bash scripts (or similar) that are located a subdirectory of your dotfiles folder, and you want to be able to use Commands are executed in your dotfiles directory, so you can specify relative paths and it'll work out just fine. You can also enable stdin/stdout/stderr as required. For example, suppose you had a bash script in your dotfiles directory, in #!/usr/bin/env bash
sudo echo this is being run as root for no good reason Then you could have your - shell:
-
description: "Run test script"
command: "./scripts/test"
stdout: true
stderr: true
stdin: true This should work like you want it to. You can disable stdin/stdout/stderr as desired (and if you omit the line, it defaults to disabled). |
Thanks @anishathalye. Reason is, I have both OSX and Linux based distros and I often am spinning fresh dev environments (that includes installing rails, spring, etc). So I wanted to create a one dotfile installer for all but currently the only way I can differentiate between OSX and Linux is $(uname -s). But this is awesome, will try it out. Once I am done, perhaps I can add this to a template thing for those who want a fresh dev environment for rails or node development. 👯 |
Ok, I see, that makes sense. You may also be interested in doing something like what was discussed in #11, perhaps even adding platform detection by Also, you could take the approach I use -- I have dotfiles contain all the shared stuff, and then I have per-machine configuration in dotfiles-local, where there is one branch corresponding to a machine or set of machines (currently with 6 sets of configuration). |
So how do I go on about calling a script on the yaml file with sudo?
Let's say I have a directory and on the root is a directory called scripts, how do I run a script in that directory and prompt for sudo when needed or as an entire execution?
The text was updated successfully, but these errors were encountered: