[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Is there a way to get the output of a function without an extra bash pro
From: |
Peng Yu |
Subject: |
Is there a way to get the output of a function without an extra bash process? |
Date: |
Sun, 10 May 2020 16:20:42 -0500 |
Hi,
$(fun) by default will always use a new bash process. This is wasteful
in certain cases. In there a way to use the existing bash process
(without using a temp file)? Thanks.
$ cat ./main2.sh
#!/usr/bin/env bash
# vim: set noexpandtab tabstop=2:
set -v
echo "$BASHPID"
function f {
echo "$BASHPID"
}
echo "$(f)"
$ ./main2.sh
echo "$BASHPID"
32056
function f {
echo "$BASHPID"
}
echo "$(f)"
32057
--
Regards,
Peng
- Is there a way to get the output of a function without an extra bash process?,
Peng Yu <=
- Re: Is there a way to get the output of a function without an extra bash process?, Eli Schwartz, 2020/05/10
- Re: Is there a way to get the output of a function without an extra bash process?, Peng Yu, 2020/05/10
- Re: Is there a way to get the output of a function without an extra bash process?, Chet Ramey, 2020/05/11
- Re: Is there a way to get the output of a function without an extra bash process?, Koichi Murase, 2020/05/11
- Re: Is there a way to get the output of a function without an extra bash process?, Peng Yu, 2020/05/11
- Re: Is there a way to get the output of a function without an extra bash process?, Chet Ramey, 2020/05/12