Hi!
I am generating a shell cut command with a series of arguments parsed from a file header.
the output of the command it redirected to a file:
cut -f 1-9,14,15 input_file > output_file
I can print the command itself into a file called mycutcommand.sh and attempt to run it from Julia:
run(`sh mycutcommand.sh`)
The script finishes with ProcessExited(0) but the output file is nowhere to be found. If I run the shell command directly it works OK. What am I doing wrong?
Here is the complete script:
query = readlines(ARGS[1]) #selected sample names
samplearray = split(read(pipeline(`head -11 $(ARGS[2])`,`tail -1`),String),r"\t")
mycutcommand = "cut -f 1-9,"
for i in query
global mycutcommand = mycutcommand * string(findall(j -> j == i, samplearray)[1]) * ","
end
myc = replace(mycutcommand, r",$" => " ") * string(ARGS[2]) * " > select.vcf"
commandfile = open("cutcommand.sh","w")
write(commandfile,myc)
mycmd = run(`sh ./cutcommand.sh`)