├── exercises ├── pipe-operator │ └── README.md ├── pokemon │ └── README.md └── challenge │ └── README.md ├── README.md └── LICENSE /exercises/pipe-operator/README.md: -------------------------------------------------------------------------------- 1 | # Operador pipe `|` 2 | 3 | Neste exercício iremos interagir com o gerenciamento de processos no Linux. Seu 4 | objetivo é contar todos os processos atualmente ativos no sistema de um determinado usuário. 5 | 6 | Dica: Chamando o `ps -aux` você conseguirá listar todos os processos que estão 7 | executando atualmente, de todos os usuários. Para listar os processos de um usuário específico 8 | você pode consultar o manual do comando `man ps` e verificar as mudanças necessárias. 9 | -------------------------------------------------------------------------------- /exercises/pokemon/README.md: -------------------------------------------------------------------------------- 1 | # Cadastro de Pokémons 2 | 3 | Neste exercício, criaremos dois pequenos scripts: `cadastrar.sh` e `consultar.sh`. 4 | O objetivo é permitir gravar em um arquivo de texto os dados sobre um determinado 5 | Pokémon e depois ser capaz de listar esses dados. 6 | 7 | ## Fluxo 8 | 9 | ### `cadastrar.sh` 10 | 11 | - Deve perguntar os seguintes dados: **nome** e **tipo** 12 | - Deve gravar em formato `nome tipo`, uma linha para cada Pokémon 13 | - Deve criar um arquivo `pokemon.txt` se não existir e, se existir, concatenar o conteúdo ao final do arquivo 14 | 15 | ### Dica: 16 | 17 | - Use `read` para ler os dados 18 | 19 | ### `consultar.sh` 20 | 21 | - Deve ser chamado como `./consultar.sh Nome` 22 | - Deve abrir o `pokemon.txt` e retornar a linha correspondente ao Pokémon 23 | 24 | #### Dica: 25 | 26 | - Você pode usar o comando `cat` para ler e `grep` para filtrar 27 | -------------------------------------------------------------------------------- /exercises/challenge/README.md: -------------------------------------------------------------------------------- 1 | # Desafio 2 | 3 | Para este desafio temos um arquivo `auth.log`, nele estão registradas as 4 | tentativas de acesso à um servidor. 5 | 6 | Para cada tentativa com senha do usuário root inválida, o registro fica no 7 | seguinte formato: 8 | ``` 9 | Aug 27 07:08:45 ubuntu69 sshd[32447]: Failed password for root from 59.45.175.98 port 54966 ssh2 10 | ``` 11 | 12 | E para cada tentativa de entrar com um usuário inexistente, o registro fica 13 | assim: 14 | ``` 15 | Aug 27 07:08:54 ubuntu69 sshd[32453]: Failed password for invalid user support from 112.238.72.189 port 34999 ssh2 16 | ``` 17 | 18 | Tendo isso em mente, seu objetivo é extrair os seguintes dados: 19 | * Gravar num arquivo a lista de IP's que tentaram (sem sucesso) acessar o servidor 20 | * Gravar num arquivo a lista de nomes inválidos que foram utilizados como tentativa 21 | * Exibir o número total de tentativas de acesso mal sucedidas 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Minicurso de Shell Script 2 | ![Creative Commons Attribution 4.0 International Public License](https://licensebuttons.net/l/by/4.0/80x15.png) 3 | 4 | ## O que é um Shell? 5 | O shell é uma das ferramentas mais básicas de um sistema operacional. Ele é 6 | responsável por interpretar comandos e acessar recursos como diretórios, 7 | arquivos, executáveis e processos. 8 | 9 | O shell não é um software em específico, existem várias implementações 10 | diferentes com funcionalidades distintas. 11 | 12 | Em sistemas derivados do Unix, o *sh* e o *bash* são os shells mais 13 | utilizados. Há também outras implementações menos conhecidas e mais específicas, 14 | como *zsh*, *fish*, *ksh*, *csh* e *tcsh*. Todos estes podem ser generalizados 15 | pelo termo **Unix Shells**. 16 | 17 | Neste curso, o shell utilizado será o **bash**, pelo motivo de estar disponível 18 | na maioria das plataformas ([inclusive no Windows](https://msdn.microsoft.com/en-us/commandline/wsl/about)). 19 | 20 | ## O que é o Shell Script? 21 | Da mesma maneira que o shell pode interpretar comandos que o usuário digita 22 | interativamente no terminal, é possível desenvolver scripts para realizar 23 | tarefas mais complexas, esses scripts acabamos chamando de **scripts em shell**. 24 | Como qualquer outra linguagem de programação, o shell definirá como os comandos, 25 | funções, operadores, fluxo de execução e variáveis irão se comportar. 26 | 27 | ## Acessando o Shell 28 | No Ubuntu, o shell pode ser acessado abrindo o Terminal. 29 | * **Importante!** - É comum confundir **shell** com o **terminal**, porém são 30 | duas aplicações completamente distintas. O **terminal** em si serve apenas para 31 | renderizar a saída de texto que é produzida pelo shell ou qualquer software que 32 | execute nele. 33 | 34 | Ao acessar o shell nos deparamos com a mensagem de _prompt_, que precede o campo 35 | para entrar com os comandos: 36 | 37 | ![prompt](https://i.imgur.com/H53X4VF.png) 38 | 39 | ## Comandos 40 | O shell faz o trabalho de mapear e disponibilizar os comandos disponíveis do 41 | sistema operacional, estes comandos podem ser: 42 | * Aplicações executáveis (mapeadas pela variável de ambiente `PATH`, que veremos a seguir) 43 | * Funções internas do shell (_builtins_) 44 | * Funções criadas pelo usuário 45 | * _Aliases_ 46 | * _Keywords_ 47 | 48 | Para verificar se um determinado comando existe e pra ver o tipo dele, utilize o 49 | comando `type`: 50 | 51 | ``` 52 | user@debian:~$ type echo 53 | echo is a shell builtin 54 | 55 | user@debian:~$ type man 56 | man is /usr/bin/man 57 | 58 | user@debian:~$ type type 59 | type is a shell builtin 60 | ``` 61 | No exemplo acima, `man` é um binário executável que está no diretório 62 | `/usr/bin`, enquanto `type` e `echo` são funções _builtins_ do shell. 63 | 64 | ### Comandos básicos 65 | Os comandos a seguir estão presentes em qualquer sistema derivado do Unix, com 66 | eles é possível interagir e navegar entre arquivos e diretórios e ter acesso a 67 | informações básicas: 68 | 69 | | Comando | Descrição | 70 | | ---------- | -------------------------------------------------| 71 | | `ls` | Lista o conteúdo do diretório atual | 72 | | `cd` | Navega entre diretórios | 73 | | `mkdir` | Cria diretórios | 74 | | `cp` | Copia arquivos e diretórios | 75 | | `rm` | Remove arquivos e diretórios | 76 | | `mv` | Move arquivos e diretórios | 77 | | `cat` | Mostra o conteúdo de arquivos | 78 | | `pwd` | Mostra o caminho do diretório atual | 79 | | `echo` | Imprime mensagem de texto | 80 | | `whoami` | Mostra o nome do usuário atual | 81 | | `uname` | Mostra informações do sistema operacional | 82 | | `man` | Mostra o manual de referência de comandos e APIs | 83 | 84 | Todos os comandos podem possuir **parâmetros** e **modificadores**, como por 85 | exemplo, o comando `ls`: 86 | 87 | ``` 88 | user@debian:~$ ls 89 | Desktop Downloads 90 | 91 | user@debian:~$ ls -l 92 | drwxr-xr-x 2 user user 4096 Sep 10 17:59 Desktop 93 | drwxr-xr-x 2 user user 4096 Sep 10 17:59 Downloads 94 | 95 | user@debian:~$ ls -la 96 | drwx------ 4 user user 4096 Sep 10 17:59 . 97 | drwxr-xr-x 5 root root 4096 Sep 10 17:58 .. 98 | -rw-r--r-- 1 user user 21 Feb 14 2017 .bash_logout 99 | -rw-r--r-- 1 user user 57 Feb 14 2017 .bash_profile 100 | -rw-r--r-- 1 user user 141 Feb 14 2017 .bashrc 101 | drwxr-xr-x 2 user user 4096 Sep 10 17:59 Desktop 102 | drwxr-xr-x 2 user user 4096 Sep 10 17:59 Downloads 103 | 104 | user@debian:~$ ls Downloads 105 | learn-shell-script.zip 106 | ``` 107 | 108 | No exemplo acima o comando `ls` é chamado com dois modificadores diferentes, o 109 | `l` e o `a`, nota-se que também é possível passar um diretório como 110 | parâmetro. 111 | * Dica: Veja o manual de referência do comando `ls` para descobrir a 112 | finalidade dos modificadores (`-l` e `-a`) utilizados acima. 113 | 114 | ## Variáveis 115 | Assim como linguagens imperativas, o shell também oferece variáveis, que podem 116 | ser atribuídas e usadas da seguinte maneira: 117 | 118 | ``` 119 | user@debian:~$ assunto="shell script" 120 | 121 | user@debian:~$ echo "Olá, vamos falar de $assunto?" 122 | Olá, vamos falar de shell script? 123 | ``` 124 | 125 | * Note que não podem haver espaços antes ou depois do operador de atribuição (`=`), caso 126 | contrário o shell interpretaria `assunto` como um comando, o que não é o que 127 | desejamos. 128 | 129 | Também é bastante útil atribuir a saída de comandos a variáveis: 130 | 131 | ``` 132 | user@debian:~$ hoje=$(date +%d/%m/%Y) 133 | 134 | user@debian:~$ agora=`date +%H:%M` 135 | 136 | user@debian:~$ echo "Olá, agora são $agora horas do dia $hoje." 137 | Olá, agora são 10:12 horas do dia 11/09/2017. 138 | ``` 139 | 140 | As duas maneiras acima, utilizando `` ` ` `` e `$()` são equivalentes. 141 | 142 | ### Variáveis de Ambiente 143 | No shell, há um conjunto de variáveis pré-definidas que são responsáveis por 144 | passar informações relevantes a programas executados por ele. Essas variáveis 145 | podem ser visualizadas com o comando `env`. 146 | 147 | A definição das variáveis de ambiente dependem de quais arquivos são carregados 148 | com a inicialização do shell. No **bash** [isso é um pouco complicado](https://askubuntu.com/a/463479), 149 | mas se você quiser modificar ou criar uma nova variável de ambiente a nível de 150 | usuário, provavelmente você irá querer modificar os arquivos `.profile` ou 151 | `.bashrc`. 152 | 153 | Há também variáveis especiais, como por exemplo o `$RANDOM`, que retorna um 154 | número aleatório a cada chamada, o `$?`, que guarda o código de saída do último 155 | comando e o `$$`, que guarda o ID de processo do shell. 156 | 157 | ## Redirecionamento de IO 158 | ### `stdin`, `stdout` e `stderr` 159 | Chamamos de `stdin` a entrada padrão de dados de um processo. 160 | 161 | Chamamos de `stdout` e `stderr` todo o texto que o processo imprime de volta 162 | para o shell. A diferença desses dois canais é que o `stderr` é 163 | convencionalmente utilizado para imprimir erros. 164 | 165 | ### Operadores 166 | O redirecionamento de entrada e saída dos comandos é uma funcionalidade bastante 167 | útil do shell script, com ela é possível manipular o fluxo da informação de uma 168 | maneira fácil. 169 | 170 | Os operadores que iremos utilizar são: 171 | 172 | | Operador | Descrição | 173 | | ---------- | --------------------------------------------------------| 174 | | `>` | Redirecionar `stdout` para arquivo (sobrescrever) | 175 | | `>>` | Redirecionar `stdout` para arquivo (inserir no final) | 176 | | `\|` | Redirecionar `stdout` como `stdin` do próximo comando | 177 | | `<` | Redirecionar o arquivo com `stdin` para o comando | 178 | | `2>` | Redirecionar `stderr` para arquivo (sobrescrever) | 179 | | `2>>` | Redirecionar `stderr` para arquivo (inserir no final) | 180 | | `2>&1\|` | Redirecionar `stderr` como `stdin` do próximo comando | 181 | 182 | A linha abaixo escreve no arquivo `processos.txt` a tabela atual de processos: 183 | ``` 184 | user@debian:~$ ps -aux > processos.txt 185 | ``` 186 | Se o arquivo não existir, ele será automaticamente criado no diretório atual. Se existir, seu 187 | conteúdo será substituído pela saída do comando. 188 | 189 | Vamos supor que esse arquivo será utilizado para algo importante, nesse caso, 190 | podemos anotar a data no final dele para informar quando o conteúdo foi 191 | extraído: 192 | ``` 193 | user@debian:~$ echo "Tabela extraída em $(date)" >> processos.txt 194 | ``` 195 | 196 | Vamos supor também que você quer enviar esse arquivo por e-mail, isso é 197 | possível com: 198 | ``` 199 | user@debian:~$ mail -s "Processos" email@domain.com < processos.txt 200 | ``` 201 | 202 | Para o operador de pipe `|`, podemos utilizar o seguinte exemplo, supondo 203 | que o arquivo `lista_de_compras.txt` seja uma lista com um tamanho considerável: 204 | ``` 205 | user@debian:~$ cat lista_de_compras.txt 206 | Abacaxi 207 | Arroz 208 | Banana 209 | Couve 210 | ... 211 | 212 | user@debian:~$ cat lista_de_compras.txt | shuf | head -n 3 213 | Pão 214 | Leite 215 | Ovo 216 | 217 | user@debian:~$ cat lista_de_compras.txt | shuf | head -n 3 218 | Arroz 219 | Iogurte 220 | Maçã 221 | ``` 222 | O que acontece acima? Neste exemplo podemos ver que 3 comandos são chamados, mas 223 | o que eles fazem, em qual ordem? 224 | 225 | Para ter uma ideia, procure saber o que os comandos `shuf` e `head` fazem, você 226 | pode consultar com o comando `man`. 227 | 228 | Experimente criar sua própria lista e testar o operador `|` (pipe) com ambos os comandos separadamente 229 | para ver o que acontece: 230 | ``` 231 | user@debian:~$ cat lista.txt | shuf 232 | ... 233 | 234 | user@debian:~$ cat lista.txt | head -n 3 235 | ... 236 | ``` 237 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Creative Commons Attribution 4.0 International Public License 2 | 3 | By exercising the Licensed Rights (defined below), You accept and agree 4 | to be bound by the terms and conditions of this Creative Commons 5 | Attribution 4.0 International Public License ("Public License"). To the 6 | extent this Public License may be interpreted as a contract, You are 7 | granted the Licensed Rights in consideration of Your acceptance of 8 | these terms and conditions, and the Licensor grants You such rights in 9 | consideration of benefits the Licensor receives from making the 10 | Licensed Material available under these terms and conditions. 11 | 12 | 13 | Section 1 -- Definitions. 14 | 15 | a. Adapted Material means material subject to Copyright and Similar 16 | Rights that is derived from or based upon the Licensed Material 17 | and in which the Licensed Material is translated, altered, 18 | arranged, transformed, or otherwise modified in a manner requiring 19 | permission under the Copyright and Similar Rights held by the 20 | Licensor. For purposes of this Public License, where the Licensed 21 | Material is a musical work, performance, or sound recording, 22 | Adapted Material is always produced where the Licensed Material is 23 | synched in timed relation with a moving image. 24 | 25 | b. Adapter's License means the license You apply to Your Copyright 26 | and Similar Rights in Your contributions to Adapted Material in 27 | accordance with the terms and conditions of this Public License. 28 | 29 | c. Copyright and Similar Rights means copyright and/or similar rights 30 | closely related to copyright including, without limitation, 31 | performance, broadcast, sound recording, and Sui Generis Database 32 | Rights, without regard to how the rights are labeled or 33 | categorized. For purposes of this Public License, the rights 34 | specified in Section 2(b)(1)-(2) are not Copyright and Similar 35 | Rights. 36 | 37 | d. Effective Technological Measures means those measures that, in the 38 | absence of proper authority, may not be circumvented under laws 39 | fulfilling obligations under Article 11 of the WIPO Copyright 40 | Treaty adopted on December 20, 1996, and/or similar international 41 | agreements. 42 | 43 | e. Exceptions and Limitations means fair use, fair dealing, and/or 44 | any other exception or limitation to Copyright and Similar Rights 45 | that applies to Your use of the Licensed Material. 46 | 47 | f. Licensed Material means the artistic or literary work, database, 48 | or other material to which the Licensor applied this Public 49 | License. 50 | 51 | g. Licensed Rights means the rights granted to You subject to the 52 | terms and conditions of this Public License, which are limited to 53 | all Copyright and Similar Rights that apply to Your use of the 54 | Licensed Material and that the Licensor has authority to license. 55 | 56 | h. Licensor means the individual(s) or entity(ies) granting rights 57 | under this Public License. 58 | 59 | i. Share means to provide material to the public by any means or 60 | process that requires permission under the Licensed Rights, such 61 | as reproduction, public display, public performance, distribution, 62 | dissemination, communication, or importation, and to make material 63 | available to the public including in ways that members of the 64 | public may access the material from a place and at a time 65 | individually chosen by them. 66 | 67 | j. Sui Generis Database Rights means rights other than copyright 68 | resulting from Directive 96/9/EC of the European Parliament and of 69 | the Council of 11 March 1996 on the legal protection of databases, 70 | as amended and/or succeeded, as well as other essentially 71 | equivalent rights anywhere in the world. 72 | 73 | k. You means the individual or entity exercising the Licensed Rights 74 | under this Public License. Your has a corresponding meaning. 75 | 76 | 77 | Section 2 -- Scope. 78 | 79 | a. License grant. 80 | 81 | 1. Subject to the terms and conditions of this Public License, 82 | the Licensor hereby grants You a worldwide, royalty-free, 83 | non-sublicensable, non-exclusive, irrevocable license to 84 | exercise the Licensed Rights in the Licensed Material to: 85 | 86 | a. reproduce and Share the Licensed Material, in whole or 87 | in part; and 88 | 89 | b. produce, reproduce, and Share Adapted Material. 90 | 91 | 2. Exceptions and Limitations. For the avoidance of doubt, where 92 | Exceptions and Limitations apply to Your use, this Public 93 | License does not apply, and You do not need to comply with 94 | its terms and conditions. 95 | 96 | 3. Term. The term of this Public License is specified in Section 97 | 6(a). 98 | 99 | 4. Media and formats; technical modifications allowed. The 100 | Licensor authorizes You to exercise the Licensed Rights in 101 | all media and formats whether now known or hereafter created, 102 | and to make technical modifications necessary to do so. The 103 | Licensor waives and/or agrees not to assert any right or 104 | authority to forbid You from making technical modifications 105 | necessary to exercise the Licensed Rights, including 106 | technical modifications necessary to circumvent Effective 107 | Technological Measures. For purposes of this Public License, 108 | simply making modifications authorized by this Section 2(a) 109 | (4) never produces Adapted Material. 110 | 111 | 5. Downstream recipients. 112 | 113 | a. Offer from the Licensor -- Licensed Material. Every 114 | recipient of the Licensed Material automatically 115 | receives an offer from the Licensor to exercise the 116 | Licensed Rights under the terms and conditions of this 117 | Public License. 118 | 119 | b. No downstream restrictions. You may not offer or impose 120 | any additional or different terms or conditions on, or 121 | apply any Effective Technological Measures to, the 122 | Licensed Material if doing so restricts exercise of the 123 | Licensed Rights by any recipient of the Licensed 124 | Material. 125 | 126 | 6. No endorsement. Nothing in this Public License constitutes or 127 | may be construed as permission to assert or imply that You 128 | are, or that Your use of the Licensed Material is, connected 129 | with, or sponsored, endorsed, or granted official status by, 130 | the Licensor or others designated to receive attribution as 131 | provided in Section 3(a)(1)(A)(i). 132 | 133 | b. Other rights. 134 | 135 | 1. Moral rights, such as the right of integrity, are not 136 | licensed under this Public License, nor are publicity, 137 | privacy, and/or other similar personality rights; however, to 138 | the extent possible, the Licensor waives and/or agrees not to 139 | assert any such rights held by the Licensor to the limited 140 | extent necessary to allow You to exercise the Licensed 141 | Rights, but not otherwise. 142 | 143 | 2. Patent and trademark rights are not licensed under this 144 | Public License. 145 | 146 | 3. To the extent possible, the Licensor waives any right to 147 | collect royalties from You for the exercise of the Licensed 148 | Rights, whether directly or through a collecting society 149 | under any voluntary or waivable statutory or compulsory 150 | licensing scheme. In all other cases the Licensor expressly 151 | reserves any right to collect such royalties. 152 | 153 | 154 | Section 3 -- License Conditions. 155 | 156 | Your exercise of the Licensed Rights is expressly made subject to the 157 | following conditions. 158 | 159 | a. Attribution. 160 | 161 | 1. If You Share the Licensed Material (including in modified 162 | form), You must: 163 | 164 | a. retain the following if it is supplied by the Licensor 165 | with the Licensed Material: 166 | 167 | i. identification of the creator(s) of the Licensed 168 | Material and any others designated to receive 169 | attribution, in any reasonable manner requested by 170 | the Licensor (including by pseudonym if 171 | designated); 172 | 173 | ii. a copyright notice; 174 | 175 | iii. a notice that refers to this Public License; 176 | 177 | iv. a notice that refers to the disclaimer of 178 | warranties; 179 | 180 | v. a URI or hyperlink to the Licensed Material to the 181 | extent reasonably practicable; 182 | 183 | b. indicate if You modified the Licensed Material and 184 | retain an indication of any previous modifications; and 185 | 186 | c. indicate the Licensed Material is licensed under this 187 | Public License, and include the text of, or the URI or 188 | hyperlink to, this Public License. 189 | 190 | 2. You may satisfy the conditions in Section 3(a)(1) in any 191 | reasonable manner based on the medium, means, and context in 192 | which You Share the Licensed Material. For example, it may be 193 | reasonable to satisfy the conditions by providing a URI or 194 | hyperlink to a resource that includes the required 195 | information. 196 | 197 | 3. If requested by the Licensor, You must remove any of the 198 | information required by Section 3(a)(1)(A) to the extent 199 | reasonably practicable. 200 | 201 | 4. If You Share Adapted Material You produce, the Adapter's 202 | License You apply must not prevent recipients of the Adapted 203 | Material from complying with this Public License. 204 | 205 | 206 | Section 4 -- Sui Generis Database Rights. 207 | 208 | Where the Licensed Rights include Sui Generis Database Rights that 209 | apply to Your use of the Licensed Material: 210 | 211 | a. for the avoidance of doubt, Section 2(a)(1) grants You the right 212 | to extract, reuse, reproduce, and Share all or a substantial 213 | portion of the contents of the database; 214 | 215 | b. if You include all or a substantial portion of the database 216 | contents in a database in which You have Sui Generis Database 217 | Rights, then the database in which You have Sui Generis Database 218 | Rights (but not its individual contents) is Adapted Material; and 219 | 220 | c. You must comply with the conditions in Section 3(a) if You Share 221 | all or a substantial portion of the contents of the database. 222 | 223 | For the avoidance of doubt, this Section 4 supplements and does not 224 | replace Your obligations under this Public License where the Licensed 225 | Rights include other Copyright and Similar Rights. 226 | 227 | 228 | Section 5 -- Disclaimer of Warranties and Limitation of Liability. 229 | 230 | a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE 231 | EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS 232 | AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF 233 | ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, 234 | IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, 235 | WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR 236 | PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, 237 | ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT 238 | KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT 239 | ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. 240 | 241 | b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE 242 | TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, 243 | NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, 244 | INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, 245 | COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR 246 | USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN 247 | ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR 248 | DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR 249 | IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. 250 | 251 | c. The disclaimer of warranties and limitation of liability provided 252 | above shall be interpreted in a manner that, to the extent 253 | possible, most closely approximates an absolute disclaimer and 254 | waiver of all liability. 255 | 256 | 257 | Section 6 -- Term and Termination. 258 | 259 | a. This Public License applies for the term of the Copyright and 260 | Similar Rights licensed here. However, if You fail to comply with 261 | this Public License, then Your rights under this Public License 262 | terminate automatically. 263 | 264 | b. Where Your right to use the Licensed Material has terminated under 265 | Section 6(a), it reinstates: 266 | 267 | 1. automatically as of the date the violation is cured, provided 268 | it is cured within 30 days of Your discovery of the 269 | violation; or 270 | 271 | 2. upon express reinstatement by the Licensor. 272 | 273 | For the avoidance of doubt, this Section 6(b) does not affect any 274 | right the Licensor may have to seek remedies for Your violations 275 | of this Public License. 276 | 277 | c. For the avoidance of doubt, the Licensor may also offer the 278 | Licensed Material under separate terms or conditions or stop 279 | distributing the Licensed Material at any time; however, doing so 280 | will not terminate this Public License. 281 | 282 | d. Sections 1, 5, 6, 7, and 8 survive termination of this Public 283 | License. 284 | 285 | 286 | Section 7 -- Other Terms and Conditions. 287 | 288 | a. The Licensor shall not be bound by any additional or different 289 | terms or conditions communicated by You unless expressly agreed. 290 | 291 | b. Any arrangements, understandings, or agreements regarding the 292 | Licensed Material not stated herein are separate from and 293 | independent of the terms and conditions of this Public License. 294 | 295 | 296 | Section 8 -- Interpretation. 297 | 298 | a. For the avoidance of doubt, this Public License does not, and 299 | shall not be interpreted to, reduce, limit, restrict, or impose 300 | conditions on any use of the Licensed Material that could lawfully 301 | be made without permission under this Public License. 302 | 303 | b. To the extent possible, if any provision of this Public License is 304 | deemed unenforceable, it shall be automatically reformed to the 305 | minimum extent necessary to make it enforceable. If the provision 306 | cannot be reformed, it shall be severed from this Public License 307 | without affecting the enforceability of the remaining terms and 308 | conditions. 309 | 310 | c. No term or condition of this Public License will be waived and no 311 | failure to comply consented to unless expressly agreed to by the 312 | Licensor. 313 | 314 | d. Nothing in this Public License constitutes or may be interpreted 315 | as a limitation upon, or waiver of, any privileges and immunities 316 | that apply to the Licensor or You, including from the legal 317 | processes of any jurisdiction or authority. 318 | 319 | 320 | ======================================================================= 321 | 322 | Creative Commons is not a party to its public 323 | licenses. Notwithstanding, Creative Commons may elect to apply one of 324 | its public licenses to material it publishes and in those instances 325 | will be considered the “Licensor.” The text of the Creative Commons 326 | public licenses is dedicated to the public domain under the CC0 Public 327 | Domain Dedication. Except for the limited purpose of indicating that 328 | material is shared under a Creative Commons public license or as 329 | otherwise permitted by the Creative Commons policies published at 330 | creativecommons.org/policies, Creative Commons does not authorize the 331 | use of the trademark "Creative Commons" or any other trademark or logo 332 | of Creative Commons without its prior written consent including, 333 | without limitation, in connection with any unauthorized modifications 334 | to any of its public licenses or any other arrangements, 335 | understandings, or agreements concerning use of licensed material. For 336 | the avoidance of doubt, this paragraph does not form part of the 337 | public licenses. 338 | 339 | Creative Commons may be contacted at creativecommons.org. 340 | --------------------------------------------------------------------------------