$ ./hello 1 > hello.txt
$ cat hello.txt
hello world
#!/bin/sh
echo "hello world"
if[filename==1]; then
echo "wrong"
fi
exit 0
$ ./error.sh > stdout_and_err.txt 2>&1
$ cat stdout_and_err.txt
hello world
./error.sh: line 5: syntax error near unexpected token `then'
./error.sh: line 5: `if[filename==1]; then'
#include <stdio.h>
int main()
{
int i;
scanf ("%d", &i);
printf ("hello test1.txt, i get your content %d\n", i);
return (0);
}
$ ./hello < test.txt > test2.txt
$ cat test2.txt
hello test1.txt, i get your content 123
#include <stdio.h>
int main()
{
char a[100];
fgets (a,99,stdin);
printf ("%s\n", a);
return (0);
}
i love linux, and you?
,
i love linux, and you?
欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) | Powered by Discuz! X3.2 |