bugGNU Parallel - Bugs: bug #66064, tutorial: More languages with...

 
 

bug #66064: tutorial: More languages with shebang

Submitter:  None
Submitted:  Mon 05 Aug 2024 04:45:14 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 05 Aug 2024 04:45:14 PM UTC, original submission:  

<verbatim>
#!/usr/bin/perl
print "Arguments: @ARGV\n";


#!/usr/bin/awk -f

BEGIN {
    printf "Arguments: "
    for (i = 1; i < ARGC; i++) {
        printf "%s ", ARGV[i]
    }
    printf "\n"
}



F#:

#!/usr/bin/env fsharpc

printfn "Arguments: %A" (System.Environment.GetCommandLineArgs() |> Array.tail)

#!/usr/bin/env fsharp
printfn "Hello, world!"

#!/bin/sh
#if run_with_bin_sh
  exec fsharpi --exec $0 $*
#endif
printfn "Hello, world!"

#!/usr/bin/env dotnet fsi
   
printfn "Hello, world!"


Scala:

#!/usr/bin/env scala

object HelloWorld {
  def main(args: Array[String]): Unit = {
    println("Hello, World!")
  }
}

#!/usr/bin/env scala

#!/usr/bin/env scala

object Main extends App {
  println(s"Arguments: ${args.mkString(" ")}")
}

val name = readLine("What is your name? ")
println("Hello " + name + "!")

Sed:
Julia:

#!/bin/bash
#=
exec julia --color=yes --startup-file=no "${BASH_SOURCE[0]}" "$@"
=#

@show ARGS  # put any Julia code here

#!/usr/bin/env julia

println("Arguments: ", join(ARGS, " "))


Groovy:
#!/bin/sh
bin/true; exec groovy -cp .. "$0"

println "Hello from Groovy"

#!/usr/bin/env groovy

println "Arguments: ${args.join(' ')}"

Kotlin (with kscript https://github.com/kscripting/kscript):

#!/usr/bin/env kscript

println("Hello from Kotlin!")
for (arg in args) {
    println("arg: $arg")
}


Racket: https://jackwarren.info/posts/guides/racket/racket-command-line/
Scheme:

#!/usr/bin/env guile

(define (print-arguments args)
  (display "Arguments: ")
  (for-each (lambda (arg)
              (display arg)
              (display " "))
            args)
  (newline))

(print-arguments (cdr (command-line)))

#!/usr/local/bin/guile \
-e main -s
!#
(define (fact-iter product counter max-count)
    (if (> counter max-count)
         product
         (fact-iter (* counter product) (+ counter 1) max-count)))
(define (factorial n)
    (fact-iter 1 1 n))
(define (main args)
    (factorial args)
)

</verbatim>

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

Only logged-in users can vote.

 

No changes have been made to this item

Back to the top

Powered by Savane 3.13-8ccc.
Corresponding source code