haiku/docs/userguide/pt_BR/bash-scripting.html
Niels Sascha Reedijk c18f9eb4ea User documentation: synchronize userguide from the userguide translator
Change-Id: I9b30ae27658a40b85c67a4c30aaea2b4bf9507f9
2021-07-21 12:54:38 +01:00

123 lines
7.5 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="pt-BR" xml:lang="pt-BR">
<head>
<!--
*
* Copyright 2009, Haiku. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Humdinger <humdingerb@gmail.com>
* Translators:
* Francisco Dourado
* tiagoms
*
-->
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="robots" content="all" />
<title>Bash e Scripting</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" type="text/css" href="../Haiku-doc.css" />
</head>
<body>
<div id="banner">
<div><span>Guia do Usuário</span></div>
</div>
<div class="nav">
<div class="inner">
<ul class="lang-menu">
<li class="now">Português (Brazil)&nbsp;<span class="dropdown-caret">&#9660;</span></li>
<li><a href="../id/bash-scripting.html">Bahasa Indonesia</a></li>
<li><a href="../ca/bash-scripting.html">Català</a></li>
<li><a href="../de/bash-scripting.html">Deutsch</a></li>
<li><a href="../en/bash-scripting.html">English</a></li>
<li><a href="../es/bash-scripting.html">Español</a></li>
<li><a href="../eo/bash-scripting.html">Esperanto</a></li>
<li><a href="../fr/bash-scripting.html">Français</a></li>
<li><a href="../fur/bash-scripting.html">Furlan</a></li>
<li><a href="../it/bash-scripting.html">Italiano</a></li>
<li><a href="../hu/bash-scripting.html">Magyar</a></li>
<li><a href="../pl/bash-scripting.html">Polski</a></li>
<li><a href="../pt_PT/bash-scripting.html">Português</a></li>
<li><a href="../ro/bash-scripting.html">Română</a></li>
<li><a href="../sk/bash-scripting.html">Slovenčina</a></li>
<li><a href="../fi/bash-scripting.html">Suomi</a></li>
<li><a href="../sv_SE/bash-scripting.html">Svenska</a></li>
<li><a href="../tr/bash-scripting.html">Türkçe</a></li>
<li><a href="../zh_CN/bash-scripting.html"> 中文 [中文]</a></li>
<li><a href="../ru/bash-scripting.html">Русский</a></li>
<li><a href="../uk/bash-scripting.html">Українська</a></li>
<li><a href="../jp/bash-scripting.html">日本語</a></li>
</ul>
<span>
«  <a href="preferences.html">Preferências</a> 
::  <a href="contents.html" class="uplink">Conteúdo</a> 
<!-- ::  <a href="filesystem-layout.html">Disposição do sistema de arquivos</a>  » -->
</span></div>
</div>
<div id="content">
<div>
<div class="box-info">A tradução desta página ainda não está completa. Até lá, partes incompletas mostrarão o original em inglês.</div>
<h1>Bash e Scripting</h1>
<p>"Scripting" é a técnica de encadear comandos formando um procedimento automatizado e salvar isso em arquivos texto, chamados "scripts". Sempre que você executa um script os comandos são processados um após o outro, como se você os digitasse num <a href="applications/terminal.html">Terminal</a>.<br />
Scripts podem executar simples comandos numa ordem específica, ou resultarem em sofisticadas peças de código que resolvem tarefas complexas.</p>
<h2>
<a href="#"><img src="../images/up.png" style="border:none;float:right" alt="index" /></a>
<a id="bash" name="bash">O Bash</a></h2>
<p>Since scripts rely naturally a lot on the shell they are interpreted by, you should first familiarize yourself with the BASH that's used by Haiku. There are many resources online as it's a widely used shell. One nice document is Johan Jansson's <a href="https://web.archive.org/web/20011205095723/http://www.beforever.com/bashtut.htm" class="printurl">Introduction to bash - a tutorial for bash under BeOS</a>.<br />
The <a href="https://www.gnu.org/software/bash/manual/bash.pdf" class="printurl">Bash Reference Manual (PDF, 720 KiB)</a> is a nice resource to get into the details.</p>
<h2>
<a href="#"><img src="../images/up.png" style="border:none;float:right" alt="index" /></a>
<a id="scripting-bible" name="scripting-bible">A Bíblia do Scripting</a></h2>
<p>Depois de ter aprendido umas noções básicas sobre como trabalhar no shell, é hora de lentamente adentrar no mundo do scripting. Novamente, você encontrará muitos tutoriais e materiais de referência online como também em livrarias. Uma introdução muito boa que foi praticamente feita sob medida para o Haiku está disponível online, é o <a href="http://www.birdhouse.org/beos/bible/bos/ch_scripting1.html" class="printurl">capítulo sobre scripting</a> (<a href="http://www.birdhouse.org/beos/bible/bos/BeOS.scripting.PDF">PDF, 900kb</a>) do livro BeOS Bible de Scot Hacker.</p>
<h2>
<a href="#"><img src="../images/up.png" style="border:none;float:right" alt="index" /></a><a id="user-scripts" name="user-scripts">Scripts no Haiku</a></h2>
<p>Haiku used to have scripts for booting and shutting down. Today it uses the <a href="https://dev.haiku-os.org/wiki/LaunchDaemon">launch_daemon</a> instead. However, the user can still augment this process with certain user scripts.
If they don't exist already, you'll have to create the needed files yourself. Otherwise simply add your commands where in the process you want them to be executed.</p>
<h3>
<a href="#"><img src="../images/up.png" style="border:none;float:right" alt="index" /></a>
<a id="userbootscript" name="userbootscript">O UserBootscript</a></h3>
<p><span class="path">/boot/home/config/settings/boot/UserBootscript</span> will be executed after the system has finished its boot process. For example, you could launch a number of programs that would then be automatically started on every boot up:</p>
<pre># Iniciar o LaunchBox
/boot/system/apps/LaunchBox &amp;
# Iniciar o Applet Workspaces
/boot/system/apps/Workspaces &amp;</pre>
<p>Lembre-se de terminar o comando com um "<tt>&amp;</tt>" para iniciá-lo como um processo em segundo plano (background process), ou o script ficará suspenso até este comando ter sido concluído (neste caso: o aplicativo aberto ser fechado novamente).</p>
<p>A simple alternative to the above for launching applications at boot up is to put links to them in the <span class="path">/boot/home/config/settings/boot/launch</span> directory. This can be done simply by right-clicking on the application you wish to have started automatically, going to <span class="menu">Create Link</span> and then <a href="tracker.html#navigating">navigating</a> to the above directory.</p>
<h3><a href="#"><img src="../images/up.png" style="border:none;float:right" alt="index" /></a>
<a id="usershutdownscript" name="usershutdownscript">The UserShutdownScript - <i>not yet working</i></a></h3>
<p><span class="path">/boot/home/config/settings/boot/UserShutdownScript</span> will be executed as the first step in the shutdown process. If the script returns a non-zero exit status, the shutdown is aborted.</p>
<h3>
<a href="#"><img src="../images/up.png" style="border:none;float:right" alt="index" /></a>
<a id="usershutdownfinishscript" name="usershutdownfinishscript">The UserShutdownFinishScript - <i>not yet working</i></a></h3>
<p><span class="path">/boot/home/config/settings/boot/UserShutdownFinishScript</span> is executed as the last step in the shutdown process. Note, that most parts of the system have terminated by the time this script is executed.</p>
</div>
</div>
<div class="nav">
<div class="inner"><span>
«  <a href="preferences.html">Preferências</a> 
::  <a href="contents.html" class="uplink">Conteúdo</a> 
<!-- ::  <a href="filesystem-layout.html">Disposição do sistema de arquivos</a>  » -->
</span></div>
</div>
</body>
</html>