[Help-bash] command substitution $( ) waits for child’s &
From:
Patrick Schleizer
Subject:
[Help-bash] command substitution $( ) waits for child’s &
Date:
Fri, 29 May 2015 23:16:43 +0000
Hi!
script x:
#!/bin/bash
set -x
output="$(./y 2>&1)"
script y:
#!/bin/bash
set -x
sleep 3 &
Script x waits until script y exits.
Due to using command substitution $( ). Without $( ) it wouldn't wait.
Why does command substitution ignore the '&'?
Is it possible to prevent waiting?
Cheers,
Patrick