Create a shell alias that R can recognise

Viewed 33

I have an alias (actually, a function) on my .bashrc but R doesn't seem to recognise it.

fun() {
  echo "Hello"
}

which runs correctly when I log in via ssh (it's a remote server). However, if I run system("fun"), I get

sh: 1: fun: not found
Warning message:
In system("fun") : error in running command

From a comment on this question I can get system("bash -i -c fun") to work, although with a weird warning/message

bash: cannot set terminal process group (27173): Inappropriate ioctl for device
bash: no job control in this shell
Hello

However, this doesn't apply to my case, because I'm running external code so I cannot modify the system() call. I need system("command") to use the command command that I defined.

BTW, this is all running on Linux (Debian in the remote server, but I also tried on my machine running elementary OS with the same result).

0 Answers
Related