Run() returns not recognized as an internal or external command

Hi community,

I tried to run linux commands in Julia through

run(pipeline(`cmd /c Rscript x.R`, `cmd /c gzip`, `cmd /c julia xx.jl`) |> file)

but then I get

‘Rscript’ is not recognized as an internal or external command,
operable program or batch file.
‘gzip’ is not recognized as an internal or external command,
operable program or batch file.
‘julia’ is not recognized as an internal or external command,
operable program or batch file.

cmd /c seems to be simply windows command, is there a way to run this in linux(Ubuntu 20.04 LTS)?

I’m not clear on what exactly you are trying to do. Are you on Windows and trying to run Linux commands in Julia? That won’t work, since Julia is just telling Windows to execute the commands.

If you are on Linux and trying to run Linux commands from Julia then you don’t want the cmd because that is a Windows command.

So on Linux the code would probably be:

run(pipeline(`Rscript x.R`, `gzip`, `julia xx.jl`) |> file)

This assumes Rscript, gzip, and julia can all be found on the path. If they are not then you would need to provide the full path to those programs.

2 Likes

My system is window10 and I just realize that I can directly run script in linux instead of through Julia.