Skip to content

bash -c #36

@nick-youngblut

Description

@nick-youngblut

In order to activate a conda env prior to running the system command, I'm using bash -c ". ~/.bashrc; conda activate MY_CONDA_ENV; MY ACTUAL COMMAND"

This works with system2(), but with exec_wait('bash', cmd), I get:

bash -c "ls -thlc"
bash: - : invalid option
Usage:	bash [GNU long option] [option] ...
	bash [GNU long option] [option] script-file ...
GNU long options:
	--debug
	--debugger
	--dump-po-strings
	--dump-strings
	--help
	--init-file
	--login
	--noediting
	--noprofile
	--norc
	--posix
	--rcfile
	--restricted
	--verbose
	--version
Shell options:
	-ilrsD or -c command or -O shopt_option		(invocation only)
	-abefhkmnptuvxBCHP or -o option

My sessionInfo:

R version 3.6.2 (2019-12-12)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.5 LTS

Matrix products: default
BLAS:   /opt/R/3.6.2/lib/R/lib/libRblas.so
LAPACK: /opt/R/3.6.2/lib/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] sys_3.4           LeyLabRMisc_0.1.7 tidytable_0.5.7   tidyselect_1.1.0  data.table_1.13.6

loaded via a namespace (and not attached):
 [1] rstudioapi_0.13  magrittr_1.5     pkgload_1.0.2    R6_2.4.1         rlang_0.4.7      fansi_0.4.0      tools_3.6.2      cli_2.0.0        withr_2.1.2     
[10] assertthat_0.2.1 rprojroot_1.3-2  tibble_2.1.3     lifecycle_0.2.0  crayon_1.3.4     purrr_0.3.3      vctrs_0.3.6      testthat_2.3.1   glue_1.4.1      
[19] compiler_3.6.2   pillar_1.4.3     desc_1.2.0       backports_1.1.5  renv_0.9.2       pkgconfig_2.0.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions