OESF Portables Forum
General Forums => General Discussion => Topic started by: Anonymous on May 27, 2004, 01:50:18 am
-
i have been wondering how to do this for about a month
is there a certain program that i need to write them with?
and where do they go & how do i put them there?
an i guess lastly how would i run the scripts?
if there is a faq that explains this clearly it certainly has gotten mixed in with a ton of other stuff on here.
:] thankx
-terrorphile
-
also is there a chat anywhere for primarily zaurus users?
-
Please register and it does not cost you $.
Which machine are you using? What have you been using in these days?
What level is your Unix knowledge? Which script are you interested: shell, Python, etc.
-
i\'m using an sl 5500 w/ the sharp rom
an i\'m just trying to find out how to write & run scripts for the zaurus
i dont have much knowledge of unix at all
thats why i\'m asking
i guess it would be a shell script
-
A shell script is a text file. Create it with \'vi\' (if you\'re running the standard ROM, you may find that the graphical text editor adds line to make it compatible with Windows, but Linux doesn\'t like it). There are also other graphical editors which you could install and use which will not cause this problem.
Scripts can go anywhere. If they are in the PATH (type \'export\' at the command prompt and see the list of directories in the PATH variable) then you can just write the name at the command prompt and the script will run. If it\'s not in the path then you either have to write the entire path:
# /path/to/my/script
Or change to the script\'s directory and run it from there like so:
# cd /path/to/my
# ./script
As I said earlier a script is just a text file, with the following line at the top (assuming you want a shell script):
#! /bin/bash
or it could have
#! /bin/sh
There are other types of script, which may use other programs to run them. For example (I think) a perl script can start like this:
#! /usr/bin/perl
Take a look here for how to actually write the contents of scripts:
http://www.tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html (http://www.tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html)
http://www.tldp.org/LDP/abs/html/index.html (http://www.tldp.org/LDP/abs/html/index.html)
Let us know how you get on.
Si
-
I\'ve got a quick question now:
#! /bin/bash
or
#!/bin/bash
I believe one is correct and the other isn\'t, even though both work.
Which way round is it?
Cheers,
Si
-
I think it is the second, the one without the space.
-
Just cheched. It is the second without the space. The first will still seem to work on the Zaurus properly because the the rest of the script is run by the original shell, which on a Zaurus is nearly always sh clone, as a shell function (like a script but without an interpretting shell).
-
Hmm, I\'m not sure. I thought I read a long long time ago that there was actually supposed to be a space, but that most people don\'t put it in.
Anyway whichever one you use it tends to work on everything I\'ve used.
Si
-
Both do, when you run it (chmod +x file.sh) by ./file.sh it uses the interpreter which can be sh, bash, perl, whatever, if you call it with sh file.sh, it will be run by that instance of the shell you create, and #!/path/to/interpreter is treated as a comment.
Hmmm, I can be wrong, though
-
also is there a chat anywhere for primarily zaurus users?
irc.freenode.net
#zaurus
#cacko
perhaps others (#openzaurus, #openembedded?)
Scott