I'm trying to better organise a bash script as part of a re-write/re-organisation and am wondering what "best practice" is in the following situation:
ymd=`echo "${NOEXT}" | egrep -o -m 1 "\-20[0-9]{2}\-[0-9]{2}\-[0-9]{2}\-"`
or
ymd=`egrep -o -m 1 "\-20[0-9]{2}\-[0-9]{2}\-[0-9]{2}\-" <<< ${NOEXT}`
I believe the first version, due to the pipe, creates a subshell. Does the second version with the here string? I'm figuring it doesn't, but want to validate my assumptions.