completed shell and r script