• Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
HomepcDuinoLinux ApplicationsInstall The Swift scripting Language on pcDuino (U ...
Previous Next

Install The Swift scripting Language on pcDuino (Ubuntu)

Posted by: Yang , June 9, 2014

Swift Quickstart


Download Swift

 Tips: Change to root user

The latest stable Swift release is Swift 0.94.1.

    1. Download the file from http://swiftlang.org/packages/swift-0.94.1.tar.gz.

    2. Extract by running “tar xfz swift-0.94.1.tar.gz”

    3. Add to PATH by running “export PATH=$PATH:/path/to/swift-0.94.1/bin”

such as: run

#export PATH=$PATH:/home/ubuntu/swift-0.94.1/bin

Run Swift


Example Swift scripts can be found in the “swift-0.94.1/examples/swift/tutorial ” directory. Scripts have a .swift file extension. Run the following commands to run a simple hello world application.

#cd swift-0.94.1/examples/swift/tutorial/ 
#swift hello.swift

When you run this application, it should create a file called hello.txt. If this file gets created, you have successfully ran your first Swift script!

#cd swift-0.94.1/examples/swift/tutorial/ 

#swift -help

#swift hello.swift
root@ubuntu:/home/ubuntu/swift-0.94.1/examples/swift/tutorial# ls
MyFirstMapper.java  capitalise_anonymous.swift  fixed_array_mapper.3.txt  foreach.3.txt  manyparam.swift        regexp_mapper.swift         three.txt
ParameterSweep      default.swift               fixed_array_mapper.swift  foreach.swift  my_first_mapper.swift  regexp_mapper.words.txt     two.txt
arrays.swift        fixed_array_mapper.1.txt    foreach.1.txt             hello.swift    one.txt                restart.swift               types.swift
capitalise.swift    fixed_array_mapper.2.txt    foreach.2.txt             if.swift       parameter.swift        sequential_iteration.swift  words.txt
root@ubuntu:/home/ubuntu/swift-0.94.1/examples/swift/tutorial# swift hello.swift 
Swift 0.94.1 swift-r7114 cog-r3803

RunID: 20140609-1707-hno24b1a
Progress:  time: Mon, 09 Jun 2014 17:07:36 +0800
Progress:  time: Mon, 09 Jun 2014 17:07:37 +0800  Checking status:1
Final status: Mon, 09 Jun 2014 17:07:38 +0800  Finished successfully:1
root@ubuntu:/home/ubuntu/swift-0.94.1/examples/swift/tutorial# ls
MyFirstMapper.java          fixed_array_mapper.1.txt  foreach.3.txt                     hello.swiftx           parameter.swift             three.txt
ParameterSweep              fixed_array_mapper.2.txt  foreach.swift                     hello.txt              regexp_mapper.swift         two.txt
arrays.swift                fixed_array_mapper.3.txt  hello-20140609-1707-hno24b1a.d    if.swift               regexp_mapper.words.txt     types.swift
capitalise.swift            fixed_array_mapper.swift  hello-20140609-1707-hno24b1a.log  manyparam.swift        restart.swift               words.txt
capitalise_anonymous.swift  foreach.1.txt             hello.kml                         my_first_mapper.swift  sequential_iteration.swift
default.swift               foreach.2.txt             hello.swift                       one.txt                swift.log
root@ubuntu:/home/ubuntu/swift-0.94.1/examples/swift/tutorial# cat hello.txt
Hello, world!

2014-06-09-170817_1280x696_scrot

 

Tags: Linux Applications

Share!
Tweet

Yang

About the author

Leave a Reply Cancel reply

You must be logged in to post a comment.

Category

  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors