Skip to content

Instantly share code, notes, and snippets.

@snobu
Last active February 1, 2017 22:15
Show Gist options
  • Select an option

  • Save snobu/da0fe3a589350e61d5bcbd718fe3da37 to your computer and use it in GitHub Desktop.

Select an option

Save snobu/da0fe3a589350e61d5bcbd718fe3da37 to your computer and use it in GitHub Desktop.
Read command line arguments in TLC
puts "Script executed with $argc arguments"
set msg ""
foreach i $argv {
append msg $i
# Append comma if there's more than one argument
if {$i ne [lindex $argv $argc-1]} {
append msg ", "
}
}
puts "SYSLOG_MSG: $msg"
# Expected output:
#
# $ tclsh args.tcl ONE TWO THREE
# Script executed with 3 arguments
# SYSLOGMSG: ONE, TWO, THREE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment