Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Scala does something similarly neat with using #| for piping system commands.

Slash for Scala is not used by default though for path joining, but it can be by adding an implicit function:

  implicit def slash(str: String) = new { def /(joinStr: String) = str + java.io.File.separatorChar + joinStr} 

  val joinedStr = "abc"/"def"/"ghi"
  > joinedStr : java.lang.String = abc/def/ghi
Shell friendly syntax can be used for stdin/stdout in Scala as well (already in the stdlib with no implicits required):

#< Redirect STDIN

#> Redirect STDOUT

#>> Append to STDOUT

#&& Create an AND list

#!! Create an OR list

http://stackoverflow.com/questions/12772605/scala-shell-comm...

http://alvinalexander.com/scala/scala-execute-exec-external-...



There are Plumbum shell combinators in Python http://plumbum.readthedocs.org/en/latest/


There are a couple of modules that do this kind of thing but Plumbum looks interesting, particularly

http://plumbum.readthedocs.org/en/latest/local_commands.html...

>from plumbum.cmd import cat

>>cat('tmp.txt') #invokes cat tmp.txt on the system




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: