On Mon, 2019-06-03 at 00:21 +0200, Ángel wrote: > Rather than adding a check after every command, I would recommend simply > adding a call to set -e
#!/bin/bash -e or what ever else, I only wanted to point out that a backup script should be safe and somehow be able to either resolve issues or to stop, instead of continuing with some kind of partial/broken backup. > and rather than those repeated lines, it can be done with a simple loop From my point of view it doesn't matter if the OP does use a loop or not, since it's unimportant regarding safeness. Depending on the experience or inexperience in writing scripts, avoiding a loop even could be the better approach. > although I would generally favor using a date-based filename, rather > than numeric ones, and let the user occasionally remove the old ones > if needed. I share this backup strategy :). I'm in favour of adding something like '$(date "+%Y%m%d_%H%M%S")' and instead of an automated backup remove rotation approach, I prefer to manually keep or remove backups, too. > please note that $(( )) is not a feature in POSIX sh, so you would > need to change the shebancg from /bin/sh to /bin/bash As pointed out by one of my previous reply, I strongly recommend to explicitly mention the used shell. Btw. there are discussions about pros and cons regarding #!/usr/bin/env bash. However, #!/bin/bash or #!/bin/dash or what ever shell else, should be ok for almost all Linux distros. Just using #!/bin/sh is a bad idea, since this nowadays usually is a link against bash, but since dash is faster, some distros, that might use an uncommon init system based upon startup scrips, might link against dash, even if the login shell should default to bash. _______________________________________________ evolution-list mailing list evolution-list@gnome.org To change your list options or unsubscribe, visit ... https://mail.gnome.org/mailman/listinfo/evolution-list