Program name: Difference between revisions

MATLAB has no endfunction keyword (if I remember correctly), so this program only works in Octave. Also, the #! is wrong.
m (promoted to task)
(MATLAB has no endfunction keyword (if I remember correctly), so this program only works in Octave. Also, the #! is wrong.)
Line 331:
module(..., package.seeall)
end</lang>
 
=={{header|MATLAB/Octave}}==
<lang octave>#!/usr/bin/env octave -qf
 
function main()
program = program_name();
printf("Program: %s", program);
endfunction
 
main();</lang>
 
=={{header|newLISP}}==
Line 357 ⟶ 347:
let program = Sys.argv.(0) in
Printf.printf "Program: %s\n" program</lang>
 
=={{header|MATLAB/Octave}}==
{{improve|Octave|<code>#!/usr/bin/env octave -qf</code> is wrong, because a #! can have only one argument.}}
<lang octave>#!/usr/bin/env octave -qf
 
function main()
program = program_name();
printf("Program: %s", program);
endfunction
 
main();</lang>
 
=={{header|Perl}}==
Line 544 ⟶ 545:
=={{header|UNIX Shell}}==
{{works with|Bourne Shell}}
<lang shbash>#!/bin/sh
 
echo "Program: $0"</lang>
Anonymous user