Just like bash invokes .bashrc
every time it starts, can scala REPL do the similar thing?
You question is quite similar to Is there a configuration file for Scala REPL / SBT Console?. However, depending on your needs you could take into account that the Scala REPL scala
command in Linux is actually a shell script that calls the Java interpreter with the corresponding Scala JAR files in the classpath.
Depending on your needs (i.e. what you need to set or do at the beginning of the REPL, that might be a place to do something there), you could create a modified version of this script or use another REPL such as Ammonite.