For instance, if it is a ksh script and a path to ksh is /usr/bin/ksh, since ksh will gladly run a script as
Code:
ksh script_name
unlike sed where you say
Code:
sed -f script_name
so you need no argument, the first line should be:
Code:
#!/usr/bin/ksh
Sometimes this is called the magic. For our memory, we call this "pound-bang"! It is documented in man 2 exec: Man Page for exec (OpenSolaris Section 2) - The UNIX and Linux Forums
It also guides the file command to identify it as a ksh script. As the man page warns, you might end up under some shell (sh?) as stdin without it. In UNIX, interpreted files with right permissions
Code:
chmod u+x script_name
are just as executable as binaries to the common loader, exec().
The only thing where scripts are second class is if you would set setuid or setgrpid bits with chmod and have scripts that change user or group; it is too insecure, so when loading setuid/setgrpid, the dynamic library path is unset by exec as it changes user/group, and withou it the ksh cannot run. A C program compiled with -R can have hard coded dynamic library paths and so be setuid/setgrpid. Many commands you use to see OS things or affect other processes are setuid to a super-user:
Code:
$ ls -ld /bin/*|sort
-r-sr-x--- 1 root suallow 24576 Aug 6 1998 /bin/su
-r-sr-xr-x 1 lp bin 16384 Oct 27 1997 /bin/slp
-r-sr-xr-x 1 root bin 20480 Jan 21 2004 /bin/newgrp
-r-sr-xr-x 1 root bin 24576 Jan 10 2001 /bin/bdf
-r-sr-xr-x 1 root bin 24576 Nov 7 2001 /bin/rexec
-r-sr-xr-x 1 root bin 28672 Mar 5 2004 /bin/nfsstat
-r-sr-xr-x 1 root bin 32768 Jun 18 2002 /bin/crontab
-r-sr-xr-x 1 root bin 32768 Nov 7 2001 /bin/remsh
-r-sr-xr-x 1 root bin 45056 Nov 7 2001 /bin/rlogin
-r-sr-xr-x 1 root bin 49152 Nov 6 1997 /bin/chkey
-r-sr-xr-x 1 root bin 49152 Nov 7 2001 /bin/rcp
-r-sr-xr-x 1 root bin 53248 Aug 14 2002 /bin/login
-r-sr-xr-x 1 root bin 53248 Jun 18 2002 /bin/at
-r-sr-xr-x 1 root bin 65536 Oct 20 1999 /bin/mediainit
-r-sr-xr-x 1 root bin 73728 Feb 25 2003 /bin/df
-r-sr-xr-x 1 root bin 73728 Nov 7 2001 /bin/rdist
-r-sr-xr-x 5 root bin 49152 May 23 2001 /bin/chfn
-r-sr-xr-x 5 root bin 49152 May 23 2001 /bin/chsh
-r-sr-xr-x 5 root bin 49152 May 23 2001 /bin/nispasswd
-r-sr-xr-x 5 root bin 49152 May 23 2001 /bin/passwd
-r-sr-xr-x 5 root bin 49152 May 23 2001 /bin/yppasswd
Last edited by DGPickett; 11-17-2010 at 09:01 PM..
could any one provide me any new real time project idea in shell scripting
i am learning shell script and wants to do some real time development . (1 Reply)
Hi All,
I am having problem with kerberos kadmin library in c++.
I am using red hat linux Enterprise Linux Server release 5 (Tikanga), and gcc c++ - 4.1.1-52.el4.i386.
When I make a c project (main.c) and use function from kadmin library such as
kadm5_init_krb5_context(&context); ... (2 Replies)
hi guys,
its been a while since my last visit here,
could not keep up the pace on this ever changing industry :)
i'd just doing my home research under vmware to make a solaris-based router-firewall using zones - doing a lot of reading about zones & review solaris zone functionality.
and... (4 Replies)
Dear all,
i am in last year of electronics department in engineering faculty
i need suggestions for a graduation project based on unix or free bsd or linux and electronics "embedded linux "
i think about embedded unix for example or device drivers
please i need helps (1 Reply)
Dear all,
i am in last year of electronics department in engineering faculty
i need suggestions for a graduation project based on unix or free bsd or linux and electronics "embedded linux "
i think about embedded unix for example or device drivers
please i need helps (1 Reply)
Dear all,
i am in last year of electronics department in engineering faculty
i need suggestions for a graduation project based on unix or free bsd or linux and electronics "embedded linux "
i think about embedded unix for example or device drivers
please i need helps (1 Reply)
Dear all,
i am in last year of electronics department in engineering faculty
i need suggestions for a graduation project based on unix or free bsd or linux and electronics "embedded linux "
i think about embedded unix for example or device drivers
please i need helps (1 Reply)
Hi friends,
I am a Computer Science student, and about to do my final year project. I am a big lover of Solaris and SPARC RISC computers, and I want to work on those computers in future. I want to become a System Administrator/Security Administrator etc on the Solaris stuff. Could you please tell... (1 Reply)
Hello,
Please suggest or share any of your experience for the following requests:
Request:
1.
Creation of the local network.
The company will be in the field of IT.
10-15 persons. 10 will be physically in the office.
The local network should be secured and all the files and... (0 Replies)