3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Swiftスクリプトで Hello world

Posted at

Swift parallel scripting language で Hello world を実行します。(同名別言語に注意)

動作環境

  • Debian 5.0.7
  • Java 1.6.0_22

パッケージを取得・展開

$ wget http://ec2-54-82-19-125.compute-1.amazonaws.com/packages/swift-0.94.1.tar.gz
$ tar xvzf swift-0.94.1.tar.gz

パスの設定

$ export PATH=$PWD/swift-0.94.1/bin:$PATH

チュートリアルのディレクトリへ移動

$ cd swift-0.94.1/examples/swift/tutorial

Swiftスクリプトの内容

$ cat hello.swift
type messagefile;

app (messagefile t) greeting() { 
    echo "Hello, world!" stdout=@filename(t);
}

messagefile outfile <"hello.txt">;

outfile = greeting();

スクリプトの実行

$ swift hello.swift 
Swift 0.94.1 swift-r7114 cog-r3803

RunID: 20140604-1434-tz4fxmg2
Progress:  time: Wed, 04 Jun 2014 14:34:49 +0900
Final status: Wed, 04 Jun 2014 14:34:49 +0900  Finished successfully:1

実行結果

$ ls -tr
...
swift.log
hello.swiftx
hello.kml
hello.txt
hello-20140604-1434-tz4fxmg2.log
hello-20140604-1434-tz4fxmg2.d

$ cat hello.txt
Hello, world!
3
2
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?