when writing bash scripts for server stuff and simple automations, what's your take on complexity?would you rather have a script that performs a few dozen checks before executing its simple command or would you like to just shovel in the command assuming it's all good?
>>100189830start simple, add checks as you face issues
>>100189830I would take the rather complicated route, but not your take.All my server scripts used a deployment script installing all dependencies, creating symlinks, installing services if necessary.But I'm done with system administration (at least for companies)
The whole point of scripting is to be simple and fast. If you need a lot of sanity checking, write a proper program. Also, scripts should only be run by people that know what they're doing. They're not supposed to be deployable or portable.
>>100189830who's going to be using it?if it's just you, then only add as much stuff as you need ie. not much because you should remember how your own tool works also, depends what the simple command is; definitely DO add a bunch of checks/confirm prompts if it could accidentally destroy stuff.eg. possibly use --interactive if doing rm if it's getting called with any input that you don't control the source of, then quite possibly forget it.
cool, thanks dudes
You shouldn't need to check anything beyond arguments passed to your script, you should know what's available on your system and write script accordingly.
If it performs 5-10 commands and maybe some pipes, I use Bash. Once the thing becomes anything larger than that, I switch to ansible. Saves me mamy hours of dealing with bash's retarded syntax and other oddities
unless you literally only need to run 2-3 commands, just use pythonbash has some of the most retarded stuff ever
>>100191656>>100190603I've become used to bash's odditiesit's over.....