[so] [Tema 1][Linux] Caractere ASCII dubioase la pipe sau la redirect
Mihai Barbulescu
b12mihai at gmail.com
Tue Mar 12 20:26:15 EET 2013
Salutare,
Am o problema foarte ciudata (si urata) pentru care imi pica _doar_ testele
09, 10, 13, 17, 18.. Am implementat ce trebuie sa faca shellul pentru pipe
(sper eu si corect) si iata ce patesc pas cu pas la testul 09, mentionez ca
m-am oprit la momentul in care suspectez eu ca da failed la testul 09:
[mihai at blackhole:]$ ./mini-shell
> echo '#include <iostream>' | cat > src1.txt
> echo 'int main() { int i; std::cin >> i; std::cout << 2 * i; std::cerr <<
4 * i; return 0; }' | cat > src2.txt
> cat src1.txt
#include <iostream>
> cat src2.txt
int main() { int i; std::cin >> i; std::cout << 2 * i; std::cerr << 4 * i;
return 0; }
> cat src1.txt src2.txt > src.cpp && rm -f src1.txt
> cat src.cpp
cat: @��src.cpp: No such file or directory
>
[mihai at blackhole:]$ cat src.cpp
#include <iostream>
int main() { int i; std::cin >> i; std::cout << 2 * i; std::cerr << 4 * i;
return 0; }
De ce dupa ce execut comanda cat src1.txt src2.txt > src.cpp && rm -f
src1.txt nu mai pot citi corect de exemplu caracterul s (de fapt observ ca
e vorba de prima litera a argumentului unei comenzi). Nu am idee ce sa mai
fac si ce bug as putea avea in cod:
> cat src.cpp
cat: @�Nsrc.cpp: No such file or directory
> cat makefile
cat: x's`2makefile: No such file or directory
> echo "message"
x's`2message
> echo "This is a huge bug"
�'s`2This is a huge bug
Iata si un output de la testul 10:
> ls -l .. | tr -s ' ' | cut -d ' ' -f 2 > out1.txt
cut: you must specify a list of bytes, characters, or fields
Try `cut --help' for more information.
> ls: cannot access x���-l: No such file or directory
ls: cannot access x���..: No such file or directory
tr: range-endpoints of `\177-s' are in reverse collating sequence order
--
Cu stimă,
Mihai Bărbulescu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cursuri.cs.pub.ro/pipermail/so/attachments/20130312/fd655414/attachment.html>
More information about the so
mailing list