Considering that you have installed R in your machine (Linux based), I feel below are the steps you can follow to run R in sh file.
OS : Mac-Os (Mojave version)
R-version : 3.6
step 1 : I have installed R in my mac machine using brew.
$ brew install r (-- This will install latest R into your machine --)
step 2 : create sample sh file. (startR.sh)
$ touch startR.sh
step 3 : copy below contents into your startR.sh file
$ vim startR.sh
(Paste below contents)
#!/bin/sh
Rscript sample.r
echo " r sample run"
exit
( --- I have created simple R file with name sample.R with below contents --)
sayHello <- function(){
print('hello')
}
sayHello()

( This is simple hello function, please feel free to change this with your actual functions)
note : please place your sample.R in same location as that of startR.sh
step 4 : change permission to .sh file
$ chmod 750 startR.sh
step 5 : execute .sh file
$ sh startR.sh
If everything goes fine, it should print below output.
During startup - Warning messages:
1: Setting LC_COLLATE failed, using "C"
2: Setting LC_TIME failed, using "C"
3: Setting LC_MESSAGES failed, using "C"
4: Setting LC_MONETARY failed, using "C"
1 "hello"
r sample run

R? Isbashyour default shell?