1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-08-28 00:53:02 +02:00

[bash] move documentation link to the end

This commit is contained in:
Boris Verkhovskiy
2025-08-23 19:41:13 -06:00
parent 46dd2bf2be
commit b5b1d6f99f
18 changed files with 74 additions and 73 deletions

View File

@@ -28,8 +28,6 @@ for the GNU operating system and as the default shell on most Linux distros.
Nearly all examples below can be a part of a shell script Nearly all examples below can be a part of a shell script
or executed directly in the shell. or executed directly in the shell.
[Read more here.](https://www.gnu.org/software/bash/manual/bashref.html)
```bash ```bash
#!/usr/bin/env bash #!/usr/bin/env bash
# First line of the script is the shebang which tells the system how to execute # First line of the script is the shebang which tells the system how to execute
@@ -526,3 +524,5 @@ info bash 'Bash Features'
info bash 6 info bash 6
info --apropos bash info --apropos bash
``` ```
For more, see the [Bash documentation](https://www.gnu.org/software/bash/manual/bashref.html).

View File

@@ -9,8 +9,6 @@ translators:
Bash ist der Name der Unix-Shell, die als Shell des GNU-Betriebssystems und auch als Standard-Shell von Linux und macOS ausgeliefert wurde. Bash ist der Name der Unix-Shell, die als Shell des GNU-Betriebssystems und auch als Standard-Shell von Linux und macOS ausgeliefert wurde.
Beinahe alle der folgenden Beispiele können als Teile eines Shell-Skripts oder direkt in der Shell ausgeführt werden. Beinahe alle der folgenden Beispiele können als Teile eines Shell-Skripts oder direkt in der Shell ausgeführt werden.
[Weitere Informationen \(Englisch\)](http://www.gnu.org/software/bash/manual/bashref.html)
```bash ```bash
#!/bin/bash #!/bin/bash
# Die erste Zeile des Scripts nennt sich Shebang, dies gibt dem System an, # Die erste Zeile des Scripts nennt sich Shebang, dies gibt dem System an,
@@ -277,3 +275,5 @@ info bash 'Bash Features'
info bash 6 info bash 6
info --apropos bash info --apropos bash
``` ```
[Weitere Informationen \(Englisch\)](https://www.gnu.org/software/bash/manual/bashref.html)

View File

@@ -9,8 +9,6 @@ contributors:
προγράμματος τερματικού (shell script) ή να εκτελεσθούν απευθείας από τον προγράμματος τερματικού (shell script) ή να εκτελεσθούν απευθείας από τον
τερματικό. τερματικό.
[Διαβάστε περισσότερα εδώ.](http://www.gnu.org/software/bash/manual/bashref.html)
```bash ```bash
#!/usr/bin/env bash #!/usr/bin/env bash
# Η πρώτη γραμμή του προγράμματος είναι το shebang που υποδεικνύει στο σύστημα # Η πρώτη γραμμή του προγράμματος είναι το shebang που υποδεικνύει στο σύστημα
@@ -195,7 +193,7 @@ then
fi fi
# Να σημειωθεί πως ο τελεστής `=~` δουλεύει μόνο με διπλές αγκύλες [[ ]], # Να σημειωθεί πως ο τελεστής `=~` δουλεύει μόνο με διπλές αγκύλες [[ ]],
# που είναι ωστόσο διαφορετικές από τις μονές [ ]. # που είναι ωστόσο διαφορετικές από τις μονές [ ].
# Δείτε το http://www.gnu.org/software/bash/manual/bashref.html#Conditional-Constructs # Δείτε το https://www.gnu.org/software/bash/manual/bashref.html#Conditional-Constructs
# για περισσότερες πληροφορίες σχετικά με αυτό. # για περισσότερες πληροφορίες σχετικά με αυτό.
# Επαναπροσδιορισμός της εντολής `ping` ως alias (ψευδώνυμο) για την αποστολή 5 # Επαναπροσδιορισμός της εντολής `ping` ως alias (ψευδώνυμο) για την αποστολή 5
@@ -522,3 +520,5 @@ info bash 'Bash Features'
info bash 6 info bash 6
info --apropos bash info --apropos bash
``` ```
[Διαβάστε περισσότερα εδώ.](https://www.gnu.org/software/bash/manual/bashref.html)

View File

@@ -17,8 +17,6 @@ el shell del sistema operativo GNU. También es el shell
por defecto de Linux y macOS. Casi todos los ejemplos abajo pueden por defecto de Linux y macOS. Casi todos los ejemplos abajo pueden
ser parte de un script shell o ser ejecutados directamente en la terminal. ser parte de un script shell o ser ejecutados directamente en la terminal.
[Leer más aquí.](http://www.gnu.org/software/bash/manual/bashref.html)
```bash ```bash
#!/bin/bash #!/bin/bash
@@ -190,3 +188,5 @@ uniq -d file.txt
# imprime sólo la primera columna antes de cada ',' en el archivo| # imprime sólo la primera columna antes de cada ',' en el archivo|
cut -d ',' -f 1 file.txt cut -d ',' -f 1 file.txt
``` ```
[Leer más aquí.](https://www.gnu.org/software/bash/manual/bashref.html)

View File

@@ -18,8 +18,6 @@ dexploitation GNU et est le shell par défaut sur Linux et macOS.
Presque tous les exemples ci-dessous peuvent être écrits dans un script shell Presque tous les exemples ci-dessous peuvent être écrits dans un script shell
ou exécutés directement dans le terminal. ou exécutés directement dans le terminal.
[Plus dinformations ici.](http://www.gnu.org/software/bash/manual/bashref.html)
```bash ```bash
#!/bin/bash #!/bin/bash
# La première ligne du script sappelle le « shebang », elle indique au système # La première ligne du script sappelle le « shebang », elle indique au système
@@ -314,3 +312,5 @@ grep -c "^foo.*bar$" fichier.txt
# lexpression rationnelle, utilisez fgrep (ou grep -F) # lexpression rationnelle, utilisez fgrep (ou grep -F)
fgrep "^foo.*bar$" fichier.txt fgrep "^foo.*bar$" fichier.txt
``` ```
[Plus dinformations ici.](https://www.gnu.org/software/bash/manual/bashref.html)

View File

@@ -21,8 +21,6 @@ translators:
Bash è il nome della shell di unix, la quale è stata distribuita anche come shell del sistema oprativo GNU e la shell di default su Linux e macOS. Bash è il nome della shell di unix, la quale è stata distribuita anche come shell del sistema oprativo GNU e la shell di default su Linux e macOS.
Quasi tutti gli esempi sottostanti possono fare parte di uno shell script o eseguiti direttamente nella shell. Quasi tutti gli esempi sottostanti possono fare parte di uno shell script o eseguiti direttamente nella shell.
[Per saperne di più.](http://www.gnu.org/software/bash/manual/bashref.html)
```bash ```bash
#!/bin/bash #!/bin/bash
# La prima riga dello script è lo shebang il quale dice al sistema come eseguire # La prima riga dello script è lo shebang il quale dice al sistema come eseguire
@@ -145,7 +143,7 @@ fi
# L'operatore =~ funziona solo dentro alle doppie parentesi quadre [[ ]], # L'operatore =~ funziona solo dentro alle doppie parentesi quadre [[ ]],
# che hanno un comportamento leggermente diverso rispetto alle singole [ ]. # che hanno un comportamento leggermente diverso rispetto alle singole [ ].
# Se vuoi approfondire, visita questo link (in inglese): # Se vuoi approfondire, visita questo link (in inglese):
# http://www.gnu.org/software/bash/manual/bashref.html#Conditional-Constructs # https://www.gnu.org/software/bash/manual/bashref.html#Conditional-Constructs
# Usando `alias`, puoi definire nuovi comandi o modificare quelli già esistenti. # Usando `alias`, puoi definire nuovi comandi o modificare quelli già esistenti.
# Ad esempio, così puoi ridefinire il comando ping per inviare solo 5 pacchetti # Ad esempio, così puoi ridefinire il comando ping per inviare solo 5 pacchetti
@@ -387,3 +385,5 @@ info bash 'Bash Features'
info bash 6 info bash 6
info --apropos bash info --apropos bash
``` ```
[Per saperne di più.](https://www.gnu.org/software/bash/manual/bashref.html)

View File

@@ -12,8 +12,6 @@ Bash はunixシェルの1つです。GNUオペレーションシステムのシ
LinuxやMac OS Xの、デフォルトシェルにもなっています。 LinuxやMac OS Xの、デフォルトシェルにもなっています。
以下にある例は、ほぼ全部シェルスクリプトの一部として使えます。また、一部はそのままシェルから実行できます。 以下にある例は、ほぼ全部シェルスクリプトの一部として使えます。また、一部はそのままシェルから実行できます。
[ちゃんとした説明は、こちらをどうぞ](http://www.gnu.org/software/bash/manual/bashref.html)
```bash ```bash
#!/bin/bash #!/bin/bash
# 最初の行はShebang(シェバング、シバン)というもので、システムに対して何を使って実行するのかを教えるためのものです # 最初の行はShebang(シェバング、シバン)というもので、システムに対して何を使って実行するのかを教えるためのものです
@@ -165,3 +163,5 @@ uniq -d file.txt
# 1行ごとに、','が最初に出てくる前の部分を表示します # 1行ごとに、','が最初に出てくる前の部分を表示します
cut -d ',' -f 1 file.txt cut -d ',' -f 1 file.txt
``` ```
[ちゃんとした説明は、こちらをどうぞ](https://www.gnu.org/software/bash/manual/bashref.html)

View File

@@ -20,8 +20,6 @@ translators:
Bash는 유닉스 셸의 이름이며, 리눅스와 맥 OS X의 기본 셸로 그리고 GNU 운영체제를 위한 셸로서 배포되었습니다. Bash는 유닉스 셸의 이름이며, 리눅스와 맥 OS X의 기본 셸로 그리고 GNU 운영체제를 위한 셸로서 배포되었습니다.
이하의 거의 모든 예시들은 셸 스크립트의 일부이거나 셸에서 바로 실행할 수 있습니다. 이하의 거의 모든 예시들은 셸 스크립트의 일부이거나 셸에서 바로 실행할 수 있습니다.
[(영어) 이곳에서 더 알아보세요.](http://www.gnu.org/software/bash/manual/bashref.html)
```bash ```bash
#!/bin/bash #!/bin/bash
# 스크립트의 첫 줄은 시스템에게 스크립트의 실행법을 알려주는 '셔뱅'입니다. # 스크립트의 첫 줄은 시스템에게 스크립트의 실행법을 알려주는 '셔뱅'입니다.
@@ -376,3 +374,5 @@ info bash 'Bash Features'
info bash 6 info bash 6
info --apropos bash info --apropos bash
``` ```
[(영어) 이곳에서 더 알아보세요.](https://www.gnu.org/software/bash/manual/bashref.html)

View File

@@ -15,8 +15,6 @@ translators:
Bash adalah nama daripada unix shell, yang mana telah diagihkan sebagai shell untuk sistem operasi GNU dan sebagai shell lalai pada Linux dan macOS. Hampir semua contoh di bawah boleh menjadi sebahagian daripada skrip shell atau dijalankan terus dalam shell. Bash adalah nama daripada unix shell, yang mana telah diagihkan sebagai shell untuk sistem operasi GNU dan sebagai shell lalai pada Linux dan macOS. Hampir semua contoh di bawah boleh menjadi sebahagian daripada skrip shell atau dijalankan terus dalam shell.
[Baca lebih lanjut di sini.](http://www.gnu.org/software/bash/manual/bashref.html)
```bash ```bash
#!/bin/bash #!/bin/bash
# Baris pertama daripada skrip ialah shebang yang mana memberitahu sistem bagaimana untuk melaksana # Baris pertama daripada skrip ialah shebang yang mana memberitahu sistem bagaimana untuk melaksana
@@ -278,3 +276,5 @@ info bash 'Bash Features'
info bash 6 info bash 6
info --apropos bash info --apropos bash
``` ```
[Baca lebih lanjut di sini.](https://www.gnu.org/software/bash/manual/bashref.html)

View File

@@ -16,8 +16,6 @@ translators:
Bash is de naam van de unix shell, deze wordt gebruikt voor het GNU operating system en is de standaard shell op Linux en macOS. Bash is de naam van de unix shell, deze wordt gebruikt voor het GNU operating system en is de standaard shell op Linux en macOS.
Bijna alle voorbeelden hieronder kunnen deel uitmaken van een shell script of kunnen uitgevoerd worden in de shell. Bijna alle voorbeelden hieronder kunnen deel uitmaken van een shell script of kunnen uitgevoerd worden in de shell.
[Lees er meer over hier.](http://www.gnu.org/software/bash/manual/bashref.html)
```bash ```bash
#!/bin/bash #!/bin/bash
# De eerste lijn in het schript is shebang, deze laat het systeem weten hoe # De eerste lijn in het schript is shebang, deze laat het systeem weten hoe
@@ -229,3 +227,5 @@ info bash 'Bash Features'
info bash 6 info bash 6
info --apropos bash info --apropos bash
``` ```
[Lees er meer over hier.](https://www.gnu.org/software/bash/manual/bashref.html)

View File

@@ -11,15 +11,14 @@ contributors:
translators: translators:
- ["Andreas Lindahl Flåten", "https://github.com/anlif"] - ["Andreas Lindahl Flåten", "https://github.com/anlif"]
--- ---
Bash er navnet på unix skallet, som også var distribuert som skallet for GNU
operativsystemet og som standard skall på de fleste Linux distribusjoner og
macOS.
[Les mer her.](http://www.gnu.org/software/bash/manual/bashref.html) Bash er navnet på unix skallet, som også var distribuert som skallet for GNU
operativsystemet og som standard skall på de fleste Linux distribusjoner og
macOS.
```bash ```bash
#!/bin/bash #!/bin/bash
# Den første linjen i et bash skript starter med '#!' (shebang) # Den første linjen i et bash skript starter med '#!' (shebang)
# etterfulgt av stien til bash http://en.wikipedia.org/wiki/Shebang_(Unix) # etterfulgt av stien til bash http://en.wikipedia.org/wiki/Shebang_(Unix)
# Kommentarer starter med #. # Kommentarer starter med #.
@@ -34,15 +33,15 @@ VARIABLE="En tekststreng"
# Men ikke slik: # Men ikke slik:
VARIABLE = "En tekststreng" VARIABLE = "En tekststreng"
# Bash vil tolke dette som at VARIABLE er en kommando den skal kjøre # Bash vil tolke dette som at VARIABLE er en kommando den skal kjøre
# og gi en feilmelding dersom kommandoen ikke finnes # og gi en feilmelding dersom kommandoen ikke finnes
# Bruk av den nydeklarerte variabelen: # Bruk av den nydeklarerte variabelen:
echo $VARIABLE echo $VARIABLE
echo "$VARIABLE" echo "$VARIABLE"
echo '$VARIABLE' echo '$VARIABLE'
# Når du bruker variabelen, for eksempel setter verdien eller eksporterer den, # Når du bruker variabelen, for eksempel setter verdien eller eksporterer den,
# skriver du navnet dens uten $. Hvis du vil bruke variabelens verdi, # skriver du navnet dens uten $. Hvis du vil bruke variabelens verdi,
# skriver du $ før variabelnavnet. # skriver du $ før variabelnavnet.
# Strenginnhold i en variabel kan erstattes på følgende måte: # Strenginnhold i en variabel kan erstattes på følgende måte:
@@ -57,7 +56,7 @@ echo ${VARIABLE:0:7}
echo ${FOO:-"StandardVerdiDersomFOOErTom"} echo ${FOO:-"StandardVerdiDersomFOOErTom"}
# Dette fungerer for null (FOO=), tom streng (FOO="") og tallet null (FOO=0) # Dette fungerer for null (FOO=), tom streng (FOO="") og tallet null (FOO=0)
# Det finnes en rekke hendige innebygde variable, eksempel: # Det finnes en rekke hendige innebygde variable, eksempel:
echo "Siste programs returnerte verdi: $?" echo "Siste programs returnerte verdi: $?"
echo "Skript's PID: $$" echo "Skript's PID: $$"
echo "Antall argumenter: $#" echo "Antall argumenter: $#"
@@ -82,7 +81,7 @@ fi
echo "Kjøres alltid" || echo "Kjøres kun dersom første kommando feilet" echo "Kjøres alltid" || echo "Kjøres kun dersom første kommando feilet"
echo "Kjøres alltid" && echo "Kjøres kun dersom første kommando IKKE feilet" echo "Kjøres alltid" && echo "Kjøres kun dersom første kommando IKKE feilet"
# For å bruke && (logisk OG) og || (logisk ELLER) sammen med if setninger, # For å bruke && (logisk OG) og || (logisk ELLER) sammen med if setninger,
# trenger man par av firkantklammer [] på hver side av et logisk uttrykk: # trenger man par av firkantklammer [] på hver side av et logisk uttrykk:
if [ $NAME == "Steve" ] && [ $AGE -eq 15 ] if [ $NAME == "Steve" ] && [ $AGE -eq 15 ]
then then
@@ -97,7 +96,7 @@ fi
# Matematiske uttrykk skrives slik: # Matematiske uttrykk skrives slik:
echo $(( 10 + 5 )) echo $(( 10 + 5 ))
# Ulikt de fleste programmeringsspråk, så er bash et skall - det medfører at en # Ulikt de fleste programmeringsspråk, så er bash et skall - det medfører at en
# kommando i et skript kjører i en bestemt mappe i filsystemet. Du kan skrive # kommando i et skript kjører i en bestemt mappe i filsystemet. Du kan skrive
# ut innholdet i nåværende mappe med ls kommandoen: # ut innholdet i nåværende mappe med ls kommandoen:
ls ls
@@ -123,7 +122,7 @@ for line in sys.stdin:
print(line, file=sys.stdout) print(line, file=sys.stdout)
EOF EOF
# Kjør hello.py (et python skript) # Kjør hello.py (et python skript)
# med ulike stdin, stdout, and stderr omdirigeringer: # med ulike stdin, stdout, and stderr omdirigeringer:
python hello.py < "input.in" python hello.py < "input.in"
python hello.py > "output.out" python hello.py > "output.out"
@@ -161,7 +160,7 @@ echo "There are $(ls | wc -l) items here."
echo "There are `ls | wc -l` items here." echo "There are `ls | wc -l` items here."
# Bash har en 'case' setning som fungerer omtrent som en 'switch' i Java/C: # Bash har en 'case' setning som fungerer omtrent som en 'switch' i Java/C:
case "$VARIABLE" in case "$VARIABLE" in
# Skriv ønskede match med tilhørende kommandoer # Skriv ønskede match med tilhørende kommandoer
0) echo "There is a zero.";; 0) echo "There is a zero.";;
1) echo "There is a one.";; 1) echo "There is a one.";;
@@ -234,7 +233,7 @@ grep "^foo.*bar$" file.txt
grep -c "^foo.*bar$" file.txt grep -c "^foo.*bar$" file.txt
# hvis du vil matche en bestemt streng, og ikke et regulært uttrykk # hvis du vil matche en bestemt streng, og ikke et regulært uttrykk
# bruker du enten "fgrep" eller ekvivalenten "grep -f" # bruker du enten "fgrep" eller ekvivalenten "grep -f"
fgrep "^foo.*bar$" file.txt fgrep "^foo.*bar$" file.txt
# Les Bash sin egen dokumentasjon om innebygde konstruksjoner: # Les Bash sin egen dokumentasjon om innebygde konstruksjoner:
@@ -262,3 +261,5 @@ info bash 'Bash Features'
info bash 6 info bash 6
info --apropos bash info --apropos bash
``` ```
[Les mer her.](https://www.gnu.org/software/bash/manual/bashref.html)

View File

@@ -12,18 +12,16 @@ translators:
Tutorial de shell em português Tutorial de shell em português
Bash é o nome do shell do Unix, que também é distribuído como shell do sistema Bash é o nome do shell do Unix, que também é distribuído como shell do sistema
operacional GNU e como shell padrão para Linux e macOS. Praticamente todos operacional GNU e como shell padrão para Linux e macOS. Praticamente todos
os exemplos abaixo podem fazer parte de um shell script e pode ser executados os exemplos abaixo podem fazer parte de um shell script e pode ser executados
diretamente no shell. diretamente no shell.
[Leia mais sobre](http://www.gnu.org/software/bash/manual/bashref.html)
```bash ```bash
#!/bin/bash #!/bin/bash
# A primeira linha do script é o shebang, que conta para o sistema como executar # A primeira linha do script é o shebang, que conta para o sistema como executar
# o script: http://en.wikipedia.org/wiki/Shebang_(Unix) # o script: http://en.wikipedia.org/wiki/Shebang_(Unix)
# Como você já deve ter percebido, comentários começam com #. # Como você já deve ter percebido, comentários começam com #.
# Shebang também é um comentário. # Shebang também é um comentário.
# Exemplo simples de hello world: # Exemplo simples de hello world:
@@ -43,7 +41,7 @@ Variavel = "Alguma string"
# Ou assim: # Ou assim:
Variavel= 'Alguma string' Variavel= 'Alguma string'
# Bash interpretará 'Alguma string' como um comando e tentará executar e lhe retornará # Bash interpretará 'Alguma string' como um comando e tentará executar e lhe retornará
# um erro porque o comando não pôde ser encontrado. (Nesse caso a a parte 'Variavel=' # um erro porque o comando não pôde ser encontrado. (Nesse caso a a parte 'Variavel='
# é vista com uma declaração de variável válida apenas para o escopo do comando 'Uma string'). # é vista com uma declaração de variável válida apenas para o escopo do comando 'Uma string').
# Usando a variável: # Usando a variável:
@@ -100,7 +98,7 @@ then
echo "Isso vai rodar se $Nome é igual Estevao E $Idade é 15." echo "Isso vai rodar se $Nome é igual Estevao E $Idade é 15."
fi fi
fi [ $Nome == "Daniela" ] || [ $Nome = "Jose" ] fi [ $Nome == "Daniela" ] || [ $Nome = "Jose" ]
then then
echo "Isso vai rodar se $Nome é Daniela ou Jose." echo "Isso vai rodar se $Nome é Daniela ou Jose."
fi fi
@@ -108,7 +106,7 @@ fi
# Expressões são escritas com o seguinte formato # Expressões são escritas com o seguinte formato
echo $(( 10 + 5)) echo $(( 10 + 5))
# Diferentemente das outras linguagens de programação, bash é um shell, então ele # Diferentemente das outras linguagens de programação, bash é um shell, então ele
# funciona no diretório atual. Você pode listar os arquivos e diretórios no diretório # funciona no diretório atual. Você pode listar os arquivos e diretórios no diretório
# atual com o comando ls: # atual com o comando ls:
ls ls
@@ -164,7 +162,7 @@ rm -v output.out error.err output-and-error.log
# O comando a seguir mostra o número de arquivos e diretórios no diretório atual # O comando a seguir mostra o número de arquivos e diretórios no diretório atual
echo "Existem $(ls | wc -l) itens aqui." echo "Existem $(ls | wc -l) itens aqui."
# O mesmo pode ser feito usando crase `` mas elas não podem ser aninhadas - dá se # O mesmo pode ser feito usando crase `` mas elas não podem ser aninhadas - dá se
# preferência ao uso do $( ) # preferência ao uso do $( )
echo "Existem `ls | wc -l` itens aqui." echo "Existem `ls | wc -l` itens aqui."
@@ -254,7 +252,7 @@ fgrep "^foo.*bar$" arquivo.txt
# Leia a documentação interna do shell Bash com o comando interno 'help': # Leia a documentação interna do shell Bash com o comando interno 'help':
help help
help help help help
help for help for
help return help return
help source help source
help . help .
@@ -267,12 +265,14 @@ man bash
# Leia a documentação de informação com info (? para ajuda) # Leia a documentação de informação com info (? para ajuda)
apropos info | grep '^info.*(' apropos info | grep '^info.*('
man info man info
info info info info
info 5 info info 5 info
#Leia a documentação informativa do Bash: #Leia a documentação informativa do Bash:
info bash info bash
info bash 'Bash Features' info bash 'Bash Features'
info bash 6 info bash 6
info --apropos bash info --apropos bash
``` ```
[Leia mais sobre](https://www.gnu.org/software/bash/manual/bashref.html)

View File

@@ -11,14 +11,12 @@ translators:
Bash este numele shell-ului UNIX, care a fost de asemenea distribuit drept shell pentru sistemul de operare GNU și ca shell implicit pentru Linux si macOS. Bash este numele shell-ului UNIX, care a fost de asemenea distribuit drept shell pentru sistemul de operare GNU și ca shell implicit pentru Linux si macOS.
Aproape toate exemplele de mai jos pot fi parte dintr-un script sau pot fi executate direct in linia de comanda. Aproape toate exemplele de mai jos pot fi parte dintr-un script sau pot fi executate direct in linia de comanda.
[Citește mai multe:](http://www.gnu.org/software/bash/manual/bashref.html)
```bash ```bash
#!/bin/bash #!/bin/bash
# Prima linie din script se numeste "shebang" # Prima linie din script se numeste "shebang"
# care spune sistemului cum să execute scriptul # care spune sistemului cum să execute scriptul
# http://en.wikipedia.org/wiki/Shebang_(Unix) # http://en.wikipedia.org/wiki/Shebang_(Unix)
# După cum te-ai prins deja, comentariile încep cu #. # După cum te-ai prins deja, comentariile încep cu #.
# Shebang este de asemenea un comentariu. # Shebang este de asemenea un comentariu.
# Exemplu simplu de hello world: # Exemplu simplu de hello world:
@@ -39,7 +37,7 @@ VARIABLE = "Niste text"
echo $VARIABLE echo $VARIABLE
echo "$VARIABLE" echo "$VARIABLE"
echo '$VARIABLE' echo '$VARIABLE'
# Atunci când folosesti variabila, o atribui, o exporți sau altfel, # Atunci când folosesti variabila, o atribui, o exporți sau altfel,
# numele ei se scrie fără $. # numele ei se scrie fără $.
# Daca vrei sa folosesti valoarea variabilei, atunci trebuie să folosești $. # Daca vrei sa folosesti valoarea variabilei, atunci trebuie să folosești $.
# Atentie la faptul că ' (apostrof) nu va inlocui variabla cu valoarea ei. # Atentie la faptul că ' (apostrof) nu va inlocui variabla cu valoarea ei.
@@ -70,7 +68,7 @@ read NAME # Observă faptul că nu a trebuit să declarăm o variabilă nouă
echo Salut, $NAME! echo Salut, $NAME!
# Avem obisnuita instructiune "if" # Avem obisnuita instructiune "if"
# Folosește "man test" pentru mai multe informații # Folosește "man test" pentru mai multe informații
# despre instrucținea conditionala # despre instrucținea conditionala
if [ $NAME -ne $USER ] if [ $NAME -ne $USER ]
then then
@@ -86,7 +84,7 @@ echo "Întotdeauna executat" && echo "Executat dacă prima instrucțiune NU esue
# Expresiile apar în urmatorul format # Expresiile apar în urmatorul format
echo $(( 10 + 5 )) echo $(( 10 + 5 ))
# Spre deosebire de alte limbaje de programare, bash este un shell - așa că # Spre deosebire de alte limbaje de programare, bash este un shell - așa că
# funcționează in contextul directorului curent. Poți vedea fișiere și directoare # funcționează in contextul directorului curent. Poți vedea fișiere și directoare
# din directorul curent folosind comanda "ls": # din directorul curent folosind comanda "ls":
ls ls
@@ -94,9 +92,9 @@ ls
# Aceste comenzi au optiuni care le controlează execuțiă # Aceste comenzi au optiuni care le controlează execuțiă
ls -l # Listează fiecare fișier și director pe o linie separată ls -l # Listează fiecare fișier și director pe o linie separată
# Rezultatele comenzii anterioare pot fi # Rezultatele comenzii anterioare pot fi
# trimise următoarei comenzi drept argument # trimise următoarei comenzi drept argument
# Comanda grep filtrează argumentele trimise cu sabloane. # Comanda grep filtrează argumentele trimise cu sabloane.
# Astfel putem vedea fiserele .txt din directorul curent. # Astfel putem vedea fiserele .txt din directorul curent.
ls -l | grep "\.txt" ls -l | grep "\.txt"
@@ -109,18 +107,18 @@ python2 hello.py 2> "erori.err"
# Daca vrei să fie concatenate datele poți folosi ">>" în loc de ">" # Daca vrei să fie concatenate datele poți folosi ">>" în loc de ">"
# Comenzile pot fi înlocuite în interiorul altor comenzi folosind $( ): # Comenzile pot fi înlocuite în interiorul altor comenzi folosind $( ):
# Urmatoarea comandă afișează numărul de fișiere # Urmatoarea comandă afișează numărul de fișiere
# și directoare din directorul curent # și directoare din directorul curent
echo "Sunt $(ls | wc -l) fișiere aici." echo "Sunt $(ls | wc -l) fișiere aici."
# Același lucru se poate obține folosind apostroful inversat ``, # Același lucru se poate obține folosind apostroful inversat ``,
# dar nu pot fi folosite limbricate, așa ca modalitatea # dar nu pot fi folosite limbricate, așa ca modalitatea
# preferată este de a folosi $( ) # preferată este de a folosi $( )
echo "Sunt `ls | wc -l` fișiere aici." echo "Sunt `ls | wc -l` fișiere aici."
# Bash folosește o instrucțiune 'case' care funcționeaza # Bash folosește o instrucțiune 'case' care funcționeaza
# în mod similar cu instructiunea switch din Java si C++ # în mod similar cu instructiunea switch din Java si C++
case "$VARIABLE" in case "$VARIABLE" in
0) echo "Este un zero.";; 0) echo "Este un zero.";;
1) echo "Este un unu.";; 1) echo "Este un unu.";;
*) echo "Nu este null";; *) echo "Nu este null";;
@@ -176,3 +174,5 @@ uniq -d file.txt
cut -d ',' -f 1 file.txt cut -d ',' -f 1 file.txt
# printează doar prima coloană inainte de caracterul "," # printează doar prima coloană inainte de caracterul ","
``` ```
[Citește mai multe:](https://www.gnu.org/software/bash/manual/bashref.html)

View File

@@ -26,8 +26,6 @@ Bash — это командная оболочка unix, которая рас
Почти все нижеприведённые примеры могут быть частью shell-скриптов Почти все нижеприведённые примеры могут быть частью shell-скриптов
или исполнены напрямую в shell. или исполнены напрямую в shell.
[Подробнее.](http://www.gnu.org/software/bash/manual/bashref.html)
```bash ```bash
#!/bin/bash #!/bin/bash
# Первая строка скрипта — это шебанг, который сообщает системе, как исполнять # Первая строка скрипта — это шебанг, который сообщает системе, как исполнять
@@ -197,7 +195,7 @@ fi
# Обратите внимание, что =~ работает только внутри # Обратите внимание, что =~ работает только внутри
# двойных квадратных скобок [[ ]], # двойных квадратных скобок [[ ]],
# которые несколько отличаются от одинарных скобок [ ]. # которые несколько отличаются от одинарных скобок [ ].
# Для более подробной информации см. http://www.gnu.org/software/bash/manual/bashref.html#Conditional-Constructs. # Для более подробной информации см. https://www.gnu.org/software/bash/manual/bashref.html#Conditional-Constructs.
# Переопределить команду «ping» как псевдоним для отправки только пяти пакетов # Переопределить команду «ping» как псевдоним для отправки только пяти пакетов
alias ping='ping -c 5' alias ping='ping -c 5'
@@ -477,3 +475,5 @@ info bash 'Bash Features'
info bash 6 info bash 6
info --apropos bash info --apropos bash
``` ```
[Подробнее](https://www.gnu.org/software/bash/manual/bashref.html).

View File

@@ -19,8 +19,6 @@ shell pre Linux a macOS.
Takmer všetky príklady uvedené nižšie môžu byť súčasťou shell skriptu alebo Takmer všetky príklady uvedené nižšie môžu byť súčasťou shell skriptu alebo
vykonané priamo v shelli. vykonané priamo v shelli.
[Viac informácií tu.](http://www.gnu.org/software/bash/manual/bashref.html)
```bash ```bash
#!/bin/bash #!/bin/bash
# Prvý riadok skriptu je tzv. shebang, ktorý systému povie ako skript vykonať: # Prvý riadok skriptu je tzv. shebang, ktorý systému povie ako skript vykonať:
@@ -280,3 +278,5 @@ info bash 'Bash Features'
info bash 6 info bash 6
info --apropos bash info --apropos bash
``` ```
[Viac informácií tu.](https://www.gnu.org/software/bash/manual/bashref.html)

View File

@@ -20,8 +20,6 @@ Bash - командна оболонка unix (unix shell), що також ро
Майже всі приклади, що наведені нижче можуть бути частиною shell-скриптів або Майже всі приклади, що наведені нижче можуть бути частиною shell-скриптів або
виконані в оболонці виконані в оболонці
[Більш детально тут.](http://www.gnu.org/software/bash/manual/bashref.html)
```bash ```bash
#!/bin/bash #!/bin/bash
# Перший рядок скрипта - це shebang, який вказує системі, як потрібно виконувати # Перший рядок скрипта - це shebang, який вказує системі, як потрібно виконувати
@@ -289,3 +287,5 @@ info bash 'Bash Features'
info bash 6 info bash 6
info --apropos bash info --apropos bash
``` ```
[Більш детально тут.](https://www.gnu.org/software/bash/manual/bashref.html)

View File

@@ -17,8 +17,6 @@ translators:
Bash 是一个为 GNU 计划编写的 Unix shell是 Linux 和 macOS 下的默认 shell。 Bash 是一个为 GNU 计划编写的 Unix shell是 Linux 和 macOS 下的默认 shell。
以下大多数例子可以作为脚本的一部分运行,也可直接在 shell 下交互执行。 以下大多数例子可以作为脚本的一部分运行,也可直接在 shell 下交互执行。
[更多信息](http://www.gnu.org/software/bash/manual/bashref.html)
```bash ```bash
#!/bin/bash #!/bin/bash
# 脚本的第一行叫 shebang用来告知系统如何执行该脚本: # 脚本的第一行叫 shebang用来告知系统如何执行该脚本:
@@ -271,3 +269,5 @@ info bash 'Bash Features'
info bash 6 info bash 6
info --apropos bash info --apropos bash
``` ```
[更多信息](https://www.gnu.org/software/bash/manual/bashref.html)

View File

@@ -22,8 +22,6 @@ translators:
Bash 是一個爲 GNU 計劃編寫的 Unix shell是 Linux 和 macOS 下預設的 shell。 Bash 是一個爲 GNU 計劃編寫的 Unix shell是 Linux 和 macOS 下預設的 shell。
以下大多數例子可以作爲腳本的一部分運行,也可直接在 shell 下互動執行。 以下大多數例子可以作爲腳本的一部分運行,也可直接在 shell 下互動執行。
[更多資訊](http://www.gnu.org/software/bash/manual/bashref.html)
```bash ```bash
#!/bin/bash #!/bin/bash
# 腳本的第一行叫 shebang用來告知系統如何執行該腳本: # 腳本的第一行叫 shebang用來告知系統如何執行該腳本:
@@ -371,3 +369,5 @@ info bash 'Bash Features'
info bash 6 info bash 6
info --apropos bash info --apropos bash
``` ```
[更多資訊](https://www.gnu.org/software/bash/manual/bashref.html)