Benutzer-Werkzeuge

Webseiten-Werkzeuge


becki:linux:bash

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
becki:linux:bash [2012-10-16 11:44]
becki
becki:linux:bash [2016-03-03 11:25] (aktuell)
becki [File Inclusion, Command Execution]
Zeile 1: Zeile 1:
-====== Bash Programming ======+====== Bash Programming == 
 +===== Documentation ​==
  
 +  - [[kman>​man1/​bash.1|Bash man page]]
 +  - [[http://​tldp.org/​LDP/​abs/​html/​|Advanced Bash-Scripting Guide]]
 ===== File Inclusion, Command Execution == ===== File Inclusion, Command Execution ==
  
Zeile 13: Zeile 16:
 **command** **command**
  
-when the shell encounters a command, it forks off a child process to actually execute the command (external commands only; from abs-guide) ​FIXME: Is this true? Isn't this ''​%%command &%%''?​+when the shell encounters a command, it forks off a child process to actually execute the command (external commands only; from abs-guide). Parent script blocks until child process ends 
 + 
 +**command &** 
 + 
 +forks off a child process to execute the command and put child process into background so that the parent script continues immediately
  
 **eval command ...** **eval command ...**
Zeile 20: Zeile 27:
  
 For me useful if command contains spaces witch are protected by single quotes, eg ''​%%wget -S --header'​Content-Type:​ application/​json'​%%''​. Without eval, ''​%%--header'​Content-Type:​%%''​ and ''​%%application/​json'​%%''​ would be interpreted as 2 single arguments For me useful if command contains spaces witch are protected by single quotes, eg ''​%%wget -S --header'​Content-Type:​ application/​json'​%%''​. Without eval, ''​%%--header'​Content-Type:​%%''​ and ''​%%application/​json'​%%''​ would be interpreted as 2 single arguments
 +
 +===== Subshells ==
 +
 +FIXME
 +
 +===== Coprocesses ==
 +
 +The following example starts a shell function as a coproc and uses the coproc to manipulate a string:
 +
 +<code bash>
 +#!/bin/bash
 +
 +test_coproc() {
 +    read rein
 +    echo ">​$rein<"​
 +}
 +
 +coproc test_coproc
 +
 +echo "​Hallo"​ >&​${COPROC[1]}
 +read -u ${COPROC[0]} rein
 +echo "​$rein"​
 +#cat <&​${COPROC[0]} # alternative
 +</​code>​
 +
 +===== Expansion ==
 +
 +FIXME doc ''​*''​ and ''?''​
 +
 +<code bash>
 +echo {a,​}quota.{group,​user}.new
 +# prints: aquota.group.new aquota.user.new quota.group.new quota.user.new
 +# without any regard to the content of the working directory
 +</​code>​
  
 ===== Variables == ===== Variables ==
 +
  
 $meli is a shortcut for ${meli} $meli is a shortcut for ${meli}
becki/linux/bash.1350387863.txt.gz · Zuletzt geändert: 2012-10-16 11:44 von becki

Impressum - Datenschutzerklärung