All pastes #398459 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-03-17 06:37 UTC
rendered paste body
bart ~ # cat demoprog.c
#include <unistd.h>
int main() {
int c=0;
while(++c) {
sleep(5);
printf("%d\n",c);
}
}
bart ~ # cc -o demoprog demoprog.c
demoprog.c: In function 'main':
demoprog.c:6: warning: incompatible implicit declaration of built-in function 'printf'
bart ~ # ./demoprog 
1
2

[1]+  Stopped                 ./demoprog
bart ~ # ./demoprog &
[2] 8617
bart ~ # 1

bart ~ # jobs
[1]+  Stopped                 ./demoprog
[2]-  Running                 ./demoprog &
bart ~ # 2
3
4
5
bg 1
[1]+ ./demoprog &
bart ~ # 3
6
4
7
5
fg 1
./demoprog

[1]+  Stopped                 ./demoprog
8
bart ~ # fg 2

./demoprog

[2]+  Stopped                 ./demoprog
bart ~ # jobs
[1]-  Stopped                 ./demoprog
[2]+  Stopped                 ./demoprog
bart ~ # kill %1
bart ~ # kill %2
[1]   Terminated              ./demoprog
[2]+  Terminated              ./demoprog
bart ~ # 
bart ~ #