tinytex icon indicating copy to clipboard operation
tinytex copied to clipboard

`install-unx.sh` change the current working dir after execution

Open cderv opened this issue 3 years ago • 2 comments

https://github.com/rstudio/tinytex/blob/18cc7c50bc52ae0b09baefe8257f68b1196245d6/tools/install-unx.sh#L21-L35

Aren't we missing a cd $PREVWD also at the end ?

I am running this on a new Linux environment, and after the installation I am in /tmp while I was not at the start.

@yihui Just wondering before doing the modification

cderv avatar Sep 19 '22 12:09 cderv

It depends on how you run the script. If you run it via sh install-unx.sh, it won't matter (the change of working directory is only transient and will be restored after sh is done). If you run the script line by line interactively in the shell, yes, the change of working directory will be permanent, as you could expect.

That said, I guess adding cd $PREVWD to the end should be fine.

yihui avatar Sep 19 '22 14:09 yihui

It depends on how you run the script. If you run it via sh install-unx.sh, it won't matter

Oh I see. I run it like that

. install-unx.sh

which execute in current environment and not another one.

cderv avatar Sep 19 '22 15:09 cderv