ficheiro1 $ printf "111" /> Não é possível redirecionar a STDIN em um shell script - O UNIX e Linux Forum
The UNIX and Linux Forums  

Go Back   O UNIX e Linux Forum > Top Fóruns > Programação Shell Script e
.
google unix.com



Programação Shell Script e Post perguntas sobre ksh, CSH, SH, BASH, Perl, PHP, SED, Awk e outros scripts shell e shell scripts línguas aqui.

Mais UNIX e Linux Fórum Tópicos Você pode achar Helpfull
Fio Thread Starter Fórum Respostas Última postagem
inline redirecionar stdin ct2marer UNIX & avançada para usuários experientes 2 09-09-2008 10:50
inline redirecionar stdin ct2marer Programação Shell Script e 5 09-09-2008 10:50
Redirecionar stdin e fora de soquetes Gyula Alto Nível de programação 1 09-02-2008 11:30
redirecionamento STDIN prkfriryce Programação Shell Script e 4 01-04-2007 10:11
stdin não tty quando tentar pinheiro ou redirecionar Micz UNIX para Dummies Perguntas & Respostas 1 05-20-2004 03:58

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
Linkback Thread Tools Pesquisar este Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-10-2009
metaltree metaltree is offline
Usuário
  
 

Join Date: Feb 2009
Local: Quebec City
Posts: 4
Não é possível redirecionar a STDIN em um shell script

Sou incapaz de usar redirecionamento STDIN com <(comandos)
Quando eu faço o seguinte, as duas abordagens trabalho e dar o mesmo resultado:

1.

Código:
$ printf "aaa\nbbb\n" > file1
$ printf "111\n222\n" > file2
$ cat file1 file2
aaa
bbb
111
222

2.

Código:
$ cat <(printf "aaa\nbbb\n") <(printf "111\n222\n")
aaa
bbb
111
222

No entanto, a segunda abordagem não irá funcionar quando eu coloco em em um script.

Estou usando Cygwin1.5.25-15

Qualquer pista?
  #2 (permalink)  
Old 02-11-2009
zaxxon's Avatar
zaxxon zaxxon is offline Forum Staff  
Moderador
  
 

Join Date: Sep 2007
Local: Alemanha
Posts: 2.313
A partir da página de manual cat:

Código:
...
cat - concatenate files and print on the standard output
...

Você deve alimentar o gato com arquivos para ouvi-lo ronronar.
  #3 (permalink)  
Old 02-11-2009
metaltree metaltree is offline
Usuário
  
 

Join Date: Feb 2009
Local: Quebec City
Posts: 4
O que eu não entendo é que o comando com <() redirecionamento funciona perfeitamente como uma única linha, mas não quando incluído em um script.
  #4 (permalink)  
Old 02-11-2009
just4fundoit just4fundoit is offline
Usuário
  
 

Join Date: Jan 2009
Lugares: 19
Thats a questão com os emuladores. Não se confunda, emuladores não são verdadeiros reservatórios, que são feitos para imitar algumas das qualidades das conchas! Se você tentar isso em um Bash / sh / ksh / csh ela funciona bem.
-Paz
  #5 (permalink)  
Old 02-11-2009
metaltree metaltree is offline
Usuário
  
 

Join Date: Feb 2009
Local: Quebec City
Posts: 4
Obrigado, mas aparentemente isso vai além do Cygwin elemento.

Tentei fazer isso em um Linux bash:

1. Funciona como uma fina linha:

Código:
-bash-3.1$ cat <(printf "aaa\nbbb\n") <(printf "111\n222\n")
aaa
bbb
111
222

2. Não funciona como um script:

Código:
 
-rw-r--r-- 1 cleseb01 cleseb01 51 Feb 11 16:27 script
-bash-3.1$ cat script 
cat <(printf "aaa\nbbb\n") <(printf "111\n222\n")
 
-bash-3.1$ sh script 
script: line 1: syntax error near unexpected token `('
script: line 1: `cat <(printf "aaa\nbbb\n") <(printf "111\n222\n")'

  #6 (permalink)  
Old 02-11-2009
vgersh99's Avatar
vgersh99 vgersh99 is offline Forum Staff  
Moderador
  
 

Join Date: Feb 2005
Localização: Boston, MA
Mensagens: 5.131

Código:
-bash-3.1$ cat myScript 
#!/bin/bash
cat <(printf "aaa\nbbb\n") <(printf "111\n222\n")

  #7 (permalink)  
Old 02-11-2009
metaltree metaltree is offline
Usuário
  
 

Join Date: Feb 2009
Local: Quebec City
Posts: 4

Código:
$ cat script
#!/bin/bash
cat <(printf "aaa\nbbb\n") <(printf "111\n222\n")


Código:
 
$ sh script
script: line 2: syntax error near unexpected token `('
script: line 2: `cat <(printf "aaa\nbbb\n") <(printf "111\n222\n")'

Closed Thread

Marcadores

Thread Tools Pesquisar este Thread
Pesquisar este Thread:

Pesquisa Avançada
Display Modes Esta taxa Thread
Esta taxa Thread:

Destacamento Regimento
Você não pode postar novas threads
Você não pode postar respostas
Você não pode postar anexos
Você não pode editar suas postagens

BB code é Ligado
Smilies são Ligado
[IMG] código é Ligado
Código HTML é Desligado
Trackbacks são Ligado
Pingbacks são Ligado
Refbacks são Ligado




Todos os horários são GMT -4. A hora é agora 02:28.


Powered by: vBulletinCopyright © 2000 - 2006, Jelsoft Enterprises Limited. Língua Traduções Powered by .
vBCredits v1.4 Copyright © 2007 - 2008, PixelFX Studios
O UNIX e Linux Fóruns Content Copyright © 1993-2009. Todos os Direitos Reserved.Ad Gestão por RedTyger

Content Relevant URLs por vBSEO 3.2.0