我最近刚开始对scala进行编程,在“scala中的编程”(www.artima.com/pins1ed)一书中,介绍了在linux中执行scala脚本的以下方法:
#!/bin/sh
exec scala "$0" "$@"
!#
// Say hello to the first argument
println("Hello, "+ args(0) +"!")
现在我已经使用linux很长时间了,但是bash脚本不是我的专长。现在我可以猜到这种scrpt是如何工作的(而且它运行得很好),但是我想知道!#和$@到底做了什么。
首先,我对编程真的很陌生。两周前我刚刚开始了我的第一堂编程课,如果我听起来新手的话,我很抱歉。
我的教授想让我实现一个“按任意键继续...”我程序里的东西。基本上,当我运行程序时,他希望出现像printf(“jfdskaljlfja”)这样的一行;然后在下一行运行之前出现“按任意键继续”。他告诉我们DOS的等价物是system(“暂停”),但他希望我们使用linux。下面是我的代码:
#include <stdio.h>
int main()
{
printf("This is the first line of this pro
可能是个愚蠢的问题。使用Mongo shell进行实验。
我想做一些类似的事情:
matt@linuxvm:~/mongodb-linux-i686-1.2.3/bin$ ./mongo
MongoDB shell version: 1.2.3
url: test
connecting to: test
Thu Feb 25 20:57:47 connection accepted from 127.0.0.1:37987 #3
type "help" for help
> function test() { debug.log("hello") }
&g