Убейте обе команды, которые выполняются одновременно в bash

Я установил guile и смог заставить его выполнять код четырьмя способами:

1

$ guile <<< "(+ 1 1)"
GNU Guile 2.0.9
Copyright (C) 1995-2013 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
$1 = 2
$ 

2

$ echo "(+ 1 1)" | guile
GNU Guile 2.0.9
Copyright (C) 1995-2013 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
$1 = 2
scheme@(guile-user)>
$ 

3

$ echo "(+ 1 1)" > guile.script
$ guile < guile.script
GNU Guile 2.0.9
Copyright (C) 1995-2013 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
$1 = 2
$ 

4

Спасибо GAD3R за этот:

$ guile -c "(display (+ 1 1)) (newline)"
2
$

Во всех случаях я возвращаюсь к исходному приглашению оболочки (на что указывают голые строки $).

1
03.05.2017, 13:11
2 ответа

Попробуйте это для того, чтобы убедиться, что вы убиваете правильный PID:

./command1 &
childpid=$!
trap "kill -TERM ${childpid}" EXIT
1
27.01.2020, 23:45

GNU Parallel учитывает Ctrl -c. Так что можешь бежать:

parallel :::./command1 /path/to/bash2
0
12.05.2020, 19:56

Теги

Похожие вопросы