Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Good job.
Although it's not 'entirely bash', non-posix, bashisms, security issues
but it's nice to see people scripting :) -
@netikras
Yeah, I'm fairly new to writing more complex bash-scripts, but I needed something, that can run without tons of additional dependency's and wasn't content with the other exiting solutions. -
@metamourge since you are, as you say, fairly new, here are a few suggestions. Feel free to ignore them if you want :)
- more often than not 'tree' is not preinstalled on systems. Either manage it as a dependency (makefile, prepare() function or whereever), or warn users in README that 'tree' is required. I hate scripters for not warning me that some speciffic tool is required and I only find it out when the script needs it....
- hardcode IFS and PATH. Either that or use full paths to binaries.
- [ x == y ] --> no need for double equality. Single is enough for comparision.
- BASH is slow. Firing new subshels make your scripts slower. Use $() and pipes as little as possible (also.. there's already a bash's built-in ${PWD} variable).
- are you sure you do not need 'cp -p' instead of just plain 'cp' ?
- user's homedir is not always at /home/<username>
- you're fucked if user enters file paths/names having spaces/tabs. Quote stuff carefully
Related Rants
-
gururaju53*Now that's what I call a Hacker* MOTHER OF ALL AUTOMATIONS This seems a long post. but you will definitely ...
-
linuxxx65This guy at my last internship. A windows fanboy to the fucking max! He was saying how he'd never use anythi...
-
creedasaurus60Another dev on my team just got a new machine. Before he came in today I made two separate USB installers and ...
Hey, fellow ranters.
I got bored and have written a script for managing dotfiles in Linux.
If anyone wants to try
https://gitlab.com/rainee/configra
rant
config
linux
dotfiles