Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see:
viewtopic.php?t=158230
Programming languages, Coding, Executables, Package Creation, and Scripting.
dlacx
Posts: 24 Joined: 2020-01-24 03:48
Has thanked: 7 times
Been thanked: 1 time
#1
Post
by dlacx » 2024-02-01 10:57
Hello bash experts,
The following
Code: Select all
$ echo "Begin"; { sleep 10; echo "1"; } & { sleep 5; echo "2"; } & wait; echo "3";
Begin
[1] 11898
[2] 11899
2
1
[1]- Done { sleep 10; echo "1"; }
[2]+ Done { sleep 5; echo "2"; }
3
produces messages as expected. With
Code: Select all
$ echo "Begin"; { sleep 10; echo "1"; } & { sleep 5; echo "2"; } & wait 2>/dev/null; echo "3";
Begin
[1] 11908
[2] 11909
2
1
3
suppress terminating messages, but I could not figure out how to suppress job start messages. The
Code: Select all
$ echo "Begin"; { sleep 10; echo "1" & } 2>/dev/null; { sleep 5; echo "2" & } 2>/dev/null; wait 2>/dev/null; echo "3";
Begin
1
2
3
runs 15secs (somehow "serial" execution manner?).
Many thanks for any help.
Leslie
Last edited by
dlacx on 2024-02-01 13:49, edited 1 time in total.
fabien
Forum Helper
Posts: 690 Joined: 2019-12-03 12:51
Location: Anarres (Toulouse, France actually)
Has thanked: 62 times
Been thanked: 161 times
#2
Post
by fabien » 2024-02-01 12:57
Hello,
an expert would probably have many interesting things to say. I can only say that
Code: Select all
$> echo "Begin"; { { sleep 10; echo -n "1 "; date; } & { sleep 5; echo -n "2 "; date; } & wait; } 2>/dev/null; echo "3"
Begin
2 Thu Feb 1 13:51:31 CET 2024
1 Thu Feb 1 13:51:36 CET 2024
3
$>
works as you expect.
fabien
Forum Helper
Posts: 690 Joined: 2019-12-03 12:51
Location: Anarres (Toulouse, France actually)
Has thanked: 62 times
Been thanked: 161 times
#4
Post
by fabien » 2024-02-01 17:58
dlacx wrote: ↑ 2024-02-01 13:48
Perfect! Thank you.
My pleasure. I forgot to say, it may be useful to be able to see some stderr messages:
Code: Select all
$> echo "Begin"; { { sleep 3; echo "1"; } & { sleep 1; echo "2"; ls /tchick; ls /tchack 2>&3; } & wait; } 3>&2 2>/dev/null; echo "3"
Begin
2
ls: cannot access '/tchack': No such file or directory
1
3
$>