run(`...`),I want to return like the shell not process

julia> run(`which samtools`)
/home/zhangchunyong/miniconda3/envs/chipseq/bin/samtools
Process(`which samtools`, ProcessExited(0))

julia> ans
Process(`which samtools`, ProcessExited(0))

But I want return “/home/zhangchunyong/miniconda3/envs/chipseq/bin/samtools”
What should I do ?Thanks

Use Sys.which("samtools").

julia> read(`which samtools`, String)
"/usr/bin/samtools\n"
2 Likes

Another variant to avoid the newline at the end:

readchomp(`which samtools`)
3 Likes