0

I am creating a terminal program and cannot find out what the ending is for Linux. I know in windows it is .cmd. Any help would be great.

Thank you.

Jon
  • 258
  • 9
  • 21

2 Answers2

1

Yes, you can remove the .sh at the end and it should work, generally using ./cmd will get it to run. this goes for C programs as well. You do not need to give an extension for the object file, You could then add a path to your bash file and then you can execute it as a normal command.

Look here.

https://stackoverflow.com/a/8779980/2720497

Community
  • 1
  • 1
Jovi Dsilva
  • 196
  • 2
  • 12
0

You don't need a file extension on Linux, though typically, people use .sh (sh being short for 'shell').

You can run it one of two ways:

bash myscript.sh 

or you can make the script itself executable and run it directly:

chmod a+x myscript.sh # make it executable
./myscript.sh # run it

Linux scripts' first line is typically #!/bin/bash which is the path to the specific shell used to run the script with the second method.

Adam D. Ruppe
  • 24,842
  • 4
  • 37
  • 58
  • Thank you. Is there anyway to make the myscript.sh run from the desktop? – Jon Dec 13 '13 at 03:41
  • If it is executable and placed on the desktop, it should work if you just click it, though this might vary from desktop to desktop. I'm not 100% sure about ubuntu. – Adam D. Ruppe Dec 13 '13 at 03:43