Skip to content

Commit 631efad

Browse files
committedFeb 14, 2025
ckssh.py: ckcommand() now uses source instead of eval
`eval $(cat file)` doesn't work on multi-line output since all the lines are concatenated to one; simply doing a `source file` fixes this. (It could also be fixed by adding semicolons to the end of each line written to eval-file, but that's more complex and doesn't provide any gain.) `eval $(ckssh.py bash-init)` does work because, though it's multi-line output, it does use semicolon separation. This can't so easily be changed however because `source` works only on files and we don't want to have to make the user create a temp file to do the bash-init.
1 parent 0552017 commit 631efad

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎bin/ckssh.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def print_bash_init(_args, _env):
213213
local retval=0;
214214
local evalfile=$(mktemp -t ckssh-eval-XXXXX);
215215
''' + me + ''' --eval-file "$evalfile" "$@"; retval=$?;
216-
eval $(cat "$evalfile");
216+
source "$evalfile";
217217
rm -f "$evalfile";
218218
return $retval;
219219
};

0 commit comments

Comments
 (0)