How commands are executing ?

Hi Folks,

I have a small doubt, the binary commands under /bin and /sbin as well as other path binary files, if you peek deep into that, you can find the difference in the way of normal perl programming and some commands will be like binary files. how are the commands executing like the difference in perl scripting and binary files.

Do you mind running that question again? I have no idea what you are asking

I think the answer might be execute permission. If a script has +x then you can execute just as you would execute a binary file. E.g.

user@linux: ls -l disk_space.sh
-rwxr-xr-x 1  user users 40 2009-07-21 12:49 disk_space.sh
user@linux:~> ./disk_space.sh
 

My script has a execute permission and I ran it like any binary file, same goes for perl scripts. But you also have to define the program which will interpret your scripts in the very first line. For Perl, it's usually, #!/usr/bin/perl or where your perl is installed. Else I'd have to use:

user@linux:sh disk_space.sh
or 
user@linux:perl some_perl_script.pl

HTH,
Nitin :slight_smile:

you are correct, the #! line tell the shell what to run the "script" under.