write output files with default name
I have prepared a shell script file and for the output I want to have a default name, but something is wrong. Can anybody revise this command?
calldir=/profile/variant/input/
base=$(echo $sam | sed "s/.sam.*/_sorted/g")
sam=/profile/variant/input/s5000W_b2.sam
--output $calldir/$(basename $base)_series_name.sam.gz
But in the output the file name didn't change and for all files its:
_series_name.sam.gz
I expected this name based on input, I want if the input change the name of output change:
s5000W_b2_series_name.sam.gz
• 2,192 views
•
link
0 answers
No answers yet.
Log in to answer this question.
Try putting the
base=command after you define thesam=variable, as$samis empty whenbaseis defined.Also, the sed command won't change antthing as there is no pattern ".sam.*" to match in the same variable
What is the 4th line of your command? Why does it start with
--output?the 4th line specify the name of output
i know something is wrong in the line 4th, "$(basename $base) " this section should get the name of input file "s5000W_b2" and create the s5000W_b2_series_call.vcf.gz
Why does it start with a
--though? No commands start with a hyphen.You haven't fully explained what you'd like to achieve. You should carefully define your inputs and your outputs. On your example, you modify the value of the $sam variable, but then immediately redeclare it with a new value - which doesn't make sense. I have no idea what the second line is attempting to do. However here is a simple example that takes your $sam and $calldir variables and spits out the value you seem to expect (I think), a few lines in a script called
test.sh:execute it:
output: