Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > alt.comp.lang.shell.unix.bourne-bash > #276
| From | Lewis <g.kreme@kreme.dont-email.me> |
|---|---|
| Newsgroups | alt.comp.lang.shell.unix.bourne-bash |
| Subject | Re: Comparing strings |
| Date | 2021-07-13 21:00 +0000 |
| Organization | Miskatonic U |
| Message-ID | <slrnservnd.20md.g.kreme@m1mini.local> (permalink) |
| References | <cbd56071-17a6-4133-93df-496eef153e06n@googlegroups.com> <sckt5u$e63$1@tncsrv09.home.tnetconsulting.net> |
In message <sckt5u$e63$1@tncsrv09.home.tnetconsulting.net> Grant Taylor <gtaylor@tnetconsulting.net> wrote:
>> if [ "$1" != "FOO" ];
if [[ $1 != "FOO" ]];
work for me.
> I would be tempted to try a case statement:
> case ${1} in
> FOO)
> # FOO's specific backup.
> BAR|BOB)
> # specific backup for BAR and BOB.
> *)
> # default backup for all other systems.
> esac
Case is what I would do as well.
> I also find that such a case statement is a lot easier to maintain long
> term as systems are added / changed / removed.
And that's why
> Depending on how the backups work, you might consider breaking out the
> actual backup actions to their discrete steps and call them as a
> function. E.g. FOO would call functions 1 and 2, while BAR & BOB call
> functions 2 and 3, and then everyone else would only call functions 1
> and 3. Use the case as a method to choosoe which pieces to run and then
> call the necessary common pieces.
Agreed.
--
The more you tighten your grip, Tarkin, the more star systems will
slip through your fingers.
Back to alt.comp.lang.shell.unix.bourne-bash | Previous | Next — Previous in thread | Next in thread | Find similar
Comparing strings ELCV <clsamcmaster@gmail.com> - 2021-07-13 10:46 -0700
Re: Comparing strings Grant Taylor <gtaylor@tnetconsulting.net> - 2021-07-13 14:29 -0600
Re: Comparing strings Lewis <g.kreme@kreme.dont-email.me> - 2021-07-13 21:00 +0000
Re: Comparing strings ELCV <clsamcmaster@gmail.com> - 2021-07-13 18:53 -0700
Re: Comparing strings ELCV <clsamcmaster@gmail.com> - 2021-07-14 08:42 -0700
Re: Comparing strings Grant Taylor <gtaylor@tnetconsulting.net> - 2021-07-14 09:58 -0600
Re: Comparing strings ELCV <clsamcmaster@gmail.com> - 2021-07-14 10:09 -0700
Re: Comparing strings Grant Taylor <gtaylor@tnetconsulting.net> - 2021-07-14 11:37 -0600
Re: Comparing strings Lewis <g.kreme@kreme.dont-email.me> - 2021-07-14 23:34 +0000
Re: Comparing strings "Michael F. Stemper" <michael.stemper@gmail.com> - 2021-07-13 16:23 -0500
Re: Comparing strings Lewis <g.kreme@kreme.dont-email.me> - 2021-07-14 00:07 +0000
csiph-web