VectorLinux
October 24, 2014, 09:23:14 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Visit our home page for VL info. To search the old message board go to http://vectorlinux.com/forum1. The first VL forum is temporarily offline until we can find a host for it. Thanks for your patience.
 
Now powered by KnowledgeDex.
   Home   Help Search Login Register  
Please support VectorLinux!
Pages: [1]
  Print  
Author Topic: Programming in VectorLinux  (Read 1176 times)
killachains82
Member
*
Posts: 2


« on: July 20, 2008, 04:28:18 am »

I'm a newbie to VL and want to learn to make executables and stuff. I've worked on XP for a while, so I do have some experience in programming. Here's a few questions:
1. Is there a language that the OS can execute directly from a file; For example: I can type some code into the file vlprogram and then execute it just like that
2. What file formats can VL execute i.e. exe's, dmg's, ...
Any help would be great

Thanks,
killachains82
Logged
kidd
Packager
Vectorian
****
Posts: 682


« Reply #1 on: July 20, 2008, 04:56:08 am »

Hi killachains82 and welcome to VL

There is a subset of languages that can be executed (actually interpreted), so
no need to compile them.

Compiled languages are typicaly faster than interpreted ones, but depending on
your hardware and your needs you can do many things in interpreted languages.

Bash is the program that manages your console, so when you do 'cd
/home/killachains' in a terminal, the string is passed to bash, and it executes
that.

Although you can do logic statements and flow control statements in bash,
there are scripting languages that are more powerful than bash like perl or
pyhton.

if you have some programming background, you'll be able to code stuff in very
little time with those.

HTH
Logged

killachains82
Member
*
Posts: 2


« Reply #2 on: July 20, 2008, 05:18:37 am »

Hi kidd
Thanks for the help
I have another question: What is a shell script and is that written in bash?
Logged
wcs
Packager
Vectorian
****
Posts: 1144


« Reply #3 on: July 20, 2008, 05:22:15 am »

Try typing some lines in a text file (as you would in a console). For example, the instruction to copy a file from one location to another.
At the top of the file put this:
Code:
#!/bin/bash
The file format will then be a bash script (regardless of the extension)... you might want to give it a .sh extension, but that's not needed.

To run it, type:
Code:
sh filename

Alternatively, you can right-click on the file, and in the properties, check "allow this file to run as a program" (assuming you're on xfce). Or (same thing), change its permissions to allow it to be executable like this:
Code:
chmod a+x filename

Then you can run it by just typing its name on a console, or by double-clicking on it in your file manager.

I suppose this is similar to a .bat file in Windows.

Besides the scripts (for bash and the other languages that kidd mentioned), VL can execute binary files that have been compiled for your architecture (whatever the language they were written on). They are not named .exe . They usually have no extension at all. The file icon will tell you if it's a binary file. For instance, go to /usr/bin and you'll find lots of executable files there (for your applications). To see the file format of a file in a console type:
Code:
file filename
The file command we'll give you something like this:
Code:
file /usr/bin/xcalc
/usr/bin/xcalc: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), stripped

Hope this helps...
Logged
wcs
Packager
Vectorian
****
Posts: 1144


« Reply #4 on: July 20, 2008, 05:24:57 am »

Quote
What is a shell script and is that written in bash?

What I said above would actually be a shell script.
You can however have scripts for different shells, bash being one of them, and the default one in VL.

Check http://en.wikipedia.org/wiki/Shell_(computing)
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!