bash_profileの関数をbashスクリプトとして呼び出す方法

bash_profileの関数をbashスクリプトとして呼び出す方法

機能があります。.bash_profile

certspotter(){
curl -s https://certspotter.com/api/v0/certs\?domain\=$1 | jq '.[].dns_names[]' | sed 's/\"//g' | sed 's/\*\.//g' | sort -u | grep $1
}

Bashスクリプトから関数を呼び出そうとしています。test.sh

ところで、以下のようなエラーが発生します。

test.sh: 4: test.sh: certspotter: not found

そのスクリプトからそれを呼び出す方法

ベストアンサー1

関数が定義されている場所(.bash_profile)をエクスポートする必要があります。

export -f certspotter

おすすめ記事