Why doesn't this work? There has to be a very simple answer to this.
I have two bash scripts. The first script calls the second which opens an editor on a tmp file, once user quits, cat the file which will be assigned to a variable in the first script.
test-use-editor
#!/bin/bash
test=$(use-editor)
echo $test
use-editor
#!/bin/bash
TMP_MSG="/tmp/tmp_msg"
$EDITOR $TMP_MSG
cat $TMP_MSG
rm $TMP_MSG
If I call use-editor
without assigning and $()
the editor opens just fine, but if I try to assign it to $test
it just hangs. The editor does start because I can see it in my processes, but it's in a subshell or something. How can I get it to open within the terminal which called the first script?