[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Portabilidade entre shells
From: |
Tiago Barcellos Peczenyj |
Subject: |
Portabilidade entre shells |
Date: |
Thu, 6 Sep 2007 15:11:13 -0300 |
Estava fazendo algumas pesquisas nessa pagina:
http://www.in-ulm.de/~mascheck/bourne/index.html
Quando encontrei esta nota " If you're interested in general script
portability, then have a look at Paul Jarc's list of suspicious or
nonportable constructs concerning modern portable script-writing."
http://code.dogmap.org/lintsh/
Ou seja, uma lista de contruções que podem funcionar no shell
corrente, porém podem não ser portáveis.
Exemplos
- "for i; do ...; done" is a syntax error for Solaris sh. However,
"for i do ...; done" works portably.
- In bash, "command >& file" runs command with standard output and
standard error redirected to file. In pdksh, it is a syntax error.
Portable syntax: "command > file 2>&1"
- Even when set -e is in effect, "foo() { return 1; }; foo" does not
cause Solaris sh to exit.
Enfim, se precisamos fazer scripts que podem ser reaproveitados no
futuro, nada melhor do que estudar as pequenas coisas que podem
atrapalhar o seu uso em outro sistema.
--
Tiago B Peczenyj
Linux User #405772
http://peczenyj.blogspot.com/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Portabilidade entre shells,
Tiago Barcellos Peczenyj <=