Date: Mon, 11 Nov 2002 11:16:01 -0500 From: Kirk Bailey <idiot1@netzero.net> To: "freebsd-questions@freebsd.org" <freebsd-questions@freebsd.org> Subject: Re: Scripts Message-ID: <3DCFD7C1.5E40721C@netzero.net> References: <3DB2A9D9.29A9862B@ev1.net> <048c01c27901$c3f3acd0$fd6e34c6@moti>
next in thread | previous in thread | raw e-mail | index | archive | help
just noticed this letter, managed to skip it when it first came in-must have been busy. Zeroth, in msdos or windows, there is a command line program that receives input, decides what to do about it, and either does it, or hands it off to another program that does it. This is a SHELL. In ms-dos, this is command.com. There are several in un*x, and the one you can always rely on to be there is called sh. under this is a library of basic functions, such as ms-dos.sys and io.sys in the world of ms-dos and windows. The names escape me in un*x, but they are there. That library of basic functions are referred to as the kernel. They are the core, and surrounding them is a interface, and in the conceptual model here, it is a SHELL surrounding these basic functions. 'sh' is the shell we normally rely on in un*x scripting. First, scripts are interpeted, not compiled. Another program reads them and performs the functions, frequently cooompiling a chunk of code then executing that, although some simply do whatever is in there, performing commands and functions already in the interpeting program. The sh script is always present in a un*x (UNIXtm is a registered Trade Mark) computer. Second, scripts tend to be slow, at least compared to a compiled executable. A sh script is very slow indeed, and very vulnerable to hacking by malicious users in the Real World of the internet, so shellscripts are NOT reccomended for webscripts. Third, every script that is to execute must be lauched, either as $sh myprogram.sh Which creates a new shell, which executes the contents of the file named (myprogram.sh) then it terminates, returning control to the shell you already have running, OR by placing a special symbol set in the VERY FIRST LINE of the script. This is referred to as a 'shebang'. #!/usr/bin/sh (Assuming the path to sh is /usr/bin !) The path to the interpeter must be correct. you ALSO must make the script executable. This means it has to live in a directory which has the x bit set, and must have IT'S x bit set; this is done with the chmod command. chmod +x cgi-bin chmod +x ./cgi-bin/myscript To invoke a such a script from the command prompt, just type in it's name. --->if that location is not on the path, you must tell it where to find it<--- EXAMPLES: ./myscript - in the current directory ./cgi-bin/myscript - in the cgi-bin dir under the current directory /home/users/deliberatus/myscript - in this EXACT location, giving the full path. some scripts use an interpeter, not a shell, suck as perl or python. #!/usr/local/bin/python If you are new to scripts, but know the commands of the sh script, try writing some toy programs in sh. If you want to learn a scripting language, try python, it's very readable and a quick learn. http://www.python.org/ hope this helps. Moti Levy wrote: > > I always liked this one : > http://www.shelldorado.com/ > ------------------------------------------------- > Moti > www.flncs.com > ------------------------------------------------- > be careful what you wish for ... > ------------------------------------------------- > > ----- Original Message ----- > From: "Mike Taylor" <mtaylor1@ev1.net> > To: <freebsd-questions@FreeBSD.ORG> > Sent: Sunday, October 20, 2002 9:04 AM > Subject: Scripts > > > I was wondering if there is a resource for pre made scripts. I am > > still very new to the whole of Unix style OSs and being able to see > > scripts from other users would help me out a lot. > > > > If you don't know of any resources for that, would it be feasible > > for the FreeBSD team to set up a spot on the FTP server for people to > > upload/submit pre built scripts? That way poeple can grab them and > > change them to fit their specific needs rather than do the whole thing > > from scratch. > > > > It would also help people like myself who are wanting to learn how > > to do these things by having a chance to see working scripts and > > figuring out how to change them around. > > > > Scripts that would be great to see would be for install, setup, > > backup and conf. > > > > I think it might even help increase/broaden the use of FreeBSD by > > giving people more resources efficiently run the OS. > > > > Thank you for your time. > > > > -- > > Mike Taylor > > A+, Network+ Certified Technician > > > > > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > > with "unsubscribe freebsd-questions" in the body of the message > > > > > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message -- end Respectfully, Kirk D Bailey +---------------------"Thou Art Free." -Eris-----------------------+ | http://www.howlermonkey.net mailto:highprimate@howlermonkey.net | | KILL spam dead! http://www.scambusters.org/stopspam/#Pledge | | http://www.tinylist.org +--------+ mailto:grumpy@tinylist.org | +------------------Thinking| NORMAL |Thinking----------------------+ +--------+ --------------------------------------------- Introducing NetZero Long Distance 1st month Free! Sign up today at: www.netzerolongdistance.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3DCFD7C1.5E40721C>