I have the following script
#!/usr/bin/Rscript
print (\"shebang works\")
in a file called shebang.r. When I run it from command line using Rsc
In addition to Sjoerd's answer... Only the directories listed in the environment variable PATH
are inspected for commands to run. You need to type ./shebang.r
(as opposed to just shebang.r
) if the current directory, known as .
, is not in your PATH
.
To inspect PATH
, type
echo $PATH
To add .
to PATH
, type
export PATH="$PATH:."
You can add this line to your ~/.bashrc
to make it happen automatically if you open a new shell.