0

I want to know how to make a program that you can edit and run. The problem is I don't know what the file extension is, like how you can make a text document on windows and save as filename.bat.

spooky
  • 1
  • I am a little unclear here. You want to make a program with Ubuntu but you want it to be a batch file you can run on Windows? – John Apr 16 '17 at 02:14
  • 2
    I think what you're looking for are shell scripts, with file extension .sh see https://bash.cyberciti.biz/guide/Hello,_World!_Tutorial – brndn2k Apr 16 '17 at 02:17
  • 1
    Like echo -e '#!/bin/bash\necho this is a script' > script.sh; chmod +x script.sh ? Then run it ./script.sh ? – Xen2050 Apr 16 '17 at 05:51
  • @brndn2k see here – jarno Apr 16 '17 at 06:13
  • no, I was wondering if I could write code in a text doc within Ubuntu then run it in Ubuntu LIKE a windows batch file – spooky May 25 '17 at 23:11

1 Answers1

0

You do not have to use a filename extension, but the file permission has to be set executable for the user who should be able to run it (unless you source a file in shell). See man chmod.

By using a shebang you can tell which interpreter to use to execute a script.

jarno
  • 5,600