Temporary variables
Giorgos Keramidas
keramida at ceid.upatras.gr
Sun Jun 2 01:39:02 EEST 2002
On 2002-06-01 19:36 +0300, V13 wrote:
> p.s. Arage posoi ksekinisan na apantane legontas oti to 'echo << _KOKO' den
> doylevei ? :)))
Ego jekinhsa na apantao legontas oti to echo <<_KOKO den tha eprepe na
douleuei, ki an douleuei einai bug tou sugkekrimenou echo, afou to
echo den upoti8etai oti anoigei kanena file descriptor gia input.
Mporei aneta[1] na einai ulopoihmeno me elaxisto kwdika, san to ejhs:
1 #include <stdio.h>
2
3 int
4 main(int argc, char *argv[])
5 {
6 int k;
7
8 if (argc > 0)
9 printf("%s", argv[1]);
10 for (k = 2; k < argc; k++)
11 printf(" %s", argv[k]);
12 printf("\n");
13 return 0;
14 }
hades+charon:~$ cc -Wall -W foo.c
hades+charon:~$ ./a.out hello world | hd
00000000 68 65 6c 6c 6f 20 77 6f 72 6c 64 0a |hello world.|
0000000c
hades+charon:~$ ./a.out hi, my name is echo < /dev/zero | hd
00000000 68 69 2c 20 6d 79 20 6e 61 6d 65 20 69 73 20 65 |hi, my name is e|
00000010 63 68 6f 0a |cho.|
00000014
hades+charon:~$
Opou den uparxei kanenos eidous interaction me to `stdin'. An estw
kai kata lathos ekane th blakeia kai anoige to stdin kai diabase, tote
to deutero a.out process pou etrekse me stdin to /dev/zero eprepe na
einai o pio adunamos krikos, to mpoulo kai ta loipa.
Alla den einai :)
BTW, kai sto zsh pou trexo ego, den douleuei to `heredoc' sto echo!
hades+charon:~$ echo <<_KOKO > foo.c
heredoc> lala
heredoc> koko
heredoc> _KOKO
hades+charon:~$ cat foo.c
hades+charon:~$ which echo
echo: shell built-in command
hades+charon:~$
- Giorgos
[1] Analoga kai me to ti lene ta standards. Den epsaksa sto SUS na
bro ti leei gia thn echo entolh kai ti prepei na uposthrizei, alla
mia entelos aploikh ulopoihsh opws h parapano einai arketa eukolh
xoris na xanei se xrhsimothta.
--
"Do you like what you doth see?" said the voluptuous elf-maiden as she
provocatively parted the folds of her robe to reveal the rounded,
shadowy glories within. [Bored of the Rings]
More information about the Linux-greek-users
mailing list