I want to create a bash script or something similar that I can execute in the current shell:
echo '#!/bin/bash
export foo="bar" ' > zoom.sh
but if I want to run this script in the current process:
exec ./zoom.sh
then my terminal will just exit "process completed", even if I use set +e
, it still exits.
There's source
and eval
which will run stuff in the current shell, so maybe eval is my best bet? A bash function will work - but I have to rely on the user to source
it in the first place.
source
or.
.eval
is for strings. – muru May 31 '19 at 04:55export PATH=
that kind of thing. – Alexander Mills May 31 '19 at 06:02source
is for. – Kusalananda May 31 '19 at 07:02