Re: [newbie] BATCH FILE
On Thu, 10 Jun 2004 21:57:20 +0200 Kaj Haulrich <[EMAIL PROTECTED]> wrote: > On Thursday 10 June 2004 21:13, H.J.Bathoorn wrote: > > On Thursday 10 June 2004 10:14, [EMAIL PROTECTED] wrote: > > > is it possible to create (save ) automatic files ( like batch > > > files in Windows) in Linux ? How ? > > > > > > I want to use this not to do always the same things in console. > > > > yes, you can put the commands you want automated in a text file. > > If there's a sequence of commands give each command it's own > > line. > > > > Run the file thus: "source name_of_file.txt" without the > > quotes and they'll get run. > > > > Good luck, > > HarM > > Just to show off as a wise guy : > > I don't think you can "run" a text file just like that. But you can > create a small script, as follows : Oh yes you can, at least under tcsh at the console. And the text file does not need executable permissions. Not to be recommended as a general method though. HarM's advice is sound. > In a text editor, type : > > #! /bin/bash > first command here > second command here > third command here > . > . > last command here > exit > > As a very useful example : > > #! /bin/bash > rpm --rebuilddb > updatedb > urpmi.update -a > ldconfig -v > update-menus -v > exit > > > When finished entering commands, save the file with some descriptive > name, like - as in the above example - "updateall". Then, go back > to the command prompt, and make this file executable. In the above > example the commands need to be run as root, so in order to make it > executable by root, first become root and then : > > chmod 777 updateall > > which will give unlimited access to the file (which doesn't matter > here). > > Now, you can run the file. If it is not in your path, just cd to the > directory containing the file and type : > > ./updateall > > That's all. > > HTH > > Kaj Haulrich. > -- > * Sent from a 100 % Microsoft-free computer * >* http://www.haulrich.net * > * running Linux kernel 2.6.4 on Mandrake 10.0 * > > -- Len Lawrence -- The two things that can get you into trouble quicker than anything else are fast women and slow horses. -- Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com Join the Club : http://www.mandrakeclub.com
Re: [newbie] BATCH FILE
On Thursday 10 June 2004 10:14, [EMAIL PROTECTED] wrote: > is it possible to create (save ) automatic files ( like batch files in > Windows) in Linux ? How ? > > I want to use this not to do always the same things in console. yes, you can put the commands you want automated in a text file. If there's a sequence of commands give each command it's own line. Run the file thus: "source name_of_file.txt" without the quotes and they'll get run. Good luck, HarM Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com Join the Club : http://www.mandrakeclub.com
Re: [newbie] BATCH FILE
Raffaele BELARDI wrote: Yes, they are called bash scripts. Create a text file with your favorite editor, containing the bash commands you want to execute, save it as , then from the console type: chmod u+x to make the script executable. To execute it, type from a console (in the directory containing the script): ./ bash provides you with lots of control commands (if, while, for...) provided you digest its anachronistic and counter-intuitive the syntax... raffaele I like to put all my shell scripts in a directory called bin off my home directory. That way, you can type the command from anywhere, and it will run. (/home//bin is in you path with the defaul setup in 9.2, and probably 10.0) If you want to see some examples of scripts, look at the entries in /etc/cron.daily, or about 1/3rd of the "programs" in /bin, /usr/bin, /sbin, /use/sbin, ect. There are also a couple of HOWTOs on writing script files, as well as many books. You are not limmited to writing them in one launge. The first line of the script tells what program to use to run the script. #!/bin/bash Mikkel -- Do not meddle in the affairs of dragons, for you are crunchy and taste good with Ketchup! Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com Join the Club : http://www.mandrakeclub.com
Re: [newbie] BATCH FILE
I mean , for example I always mount a flash drive in console with some commands. I want to write these commands to a file ( like batch files in windows) and save this file on desktop. And if I want to run these command file I will double click on this file and it will run automatically and do the job for me ?? Best regards. Hakan Ertas Uretim Yoneticisi / Production Manager Dr. Oetker Gıda San. A.Ş. ( IZMIR , TURKEY ) Tel : +90 232 8641800 - 220 [EMAIL PROTECTED] Chipo Hamayobe <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Sent by:cc: [EMAIL PROTECTED]Subject: Re: [newbie] BATCH FILE andrake.com 10.06.2004 11:29 Please respond to newbie On Thu, 10 Jun 2004 [EMAIL PROTECTED] wrote: > is it possible to create (save ) automatic files ( like batch files in > Windows) in Linux ? How ? > I want to use this not to do always the same things in console. i cant seem to understand your question. can you please explain what you mean. chipo --- [EMAIL PROTECTED] Registered Linux User #353653 Cell: +27 73 501 8813 Tel: +27 21 685 4050 ext 228 Fax: +27 21 650 3465 URL: http://www.unix.za.net/~chipo Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com Join the Club : http://www.mandrakeclub.com Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com Join the Club : http://www.mandrakeclub.com
Re: [newbie] BATCH FILE
On Thu, 10 Jun 2004 [EMAIL PROTECTED] wrote: > is it possible to create (save ) automatic files ( like batch files in > Windows) in Linux ? How ? > I want to use this not to do always the same things in console. i cant seem to understand your question. can you please explain what you mean. chipo --- [EMAIL PROTECTED] Registered Linux User #353653 Cell: +27 73 501 8813 Tel: +27 21 685 4050 ext 228 Fax: +27 21 650 3465 URL: http://www.unix.za.net/~chipo Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com Join the Club : http://www.mandrakeclub.com
[newbie] BATCH FILE
hello friends, is it possible to create (save ) automatic files ( like batch files in Windows) in Linux ? How ? I want to use this not to do always the same things in console. Best Regards Hakan Ertas Uretim Yoneticisi / Production Manager Dr. Oetker Gıda San. A.Ş. ( IZMIR , TURKEY ) Tel : +90 232 8641800 - 220 [EMAIL PROTECTED] Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com Join the Club : http://www.mandrakeclub.com
Re: [newbie] Batch File In Linux???
You can use "vi" or "kedit" to write the file. Here is an example of a batch file: #!/bin/sh /* This line must be included always */ cd /home/jcc/setiathome-3.03/* A go to a directory and run an file */ ./setiathome -nice 19 & /* Current directory is not in PATH, you must */ /* specificate it with "./" before the filename */ /* The & means it run in background */ ps -e | grep setiathome /* Another commands */ cat state.sah | grep prog= You must make it executable with: chmod +x filename I hope this help you. On Sat 14 Jul 2001 05:22, you wrote: > Hi there, > > I was wondering if someone could help me write the equivalent of a batch > file for Linux. This is what I need it to do: > > 1. Open up a Konsole (preferably minimized) and change to the following > folder: > (/usr/local/bin/Half-Life/hlds_l/), then run the command: startup and > keep the Konsole running > > 2. Open up another new Konsole (preferably minimized as well) and > change to the following folder (/usr/local/bin/Half-Life/hlds_l/PB/) > then run the command: pb also keep the Konsole running after running > the program > > I'd like to have this so that I can double click on the "batch file" and > have it run, or if I have to run it through Konsole, I'd like as an > additional step to have the Konsole that I used to run the "batch file" > to close after issuing the two commands if possible. > > TIA > > Curtis > >_ Get Your Private, Free E-mail from MSN Hotmail at > http://www.hotmail.com. -- Juan Carlos Conde e-mail: [EMAIL PROTECTED] Valladolid (Spain)Running Linux Mandrake 8.0 Linux Registered User: 219425 - http://counter.li.org/ __ mensaje enviado desde http://www.iespana.es emails (pop)-paginas web (espacio illimitado)-agenda-favoris (bookmarks)-foros
[newbie] Batch File In Linux???
Hi there, I was wondering if someone could help me write the equivalent of a batch file for Linux. This is what I need it to do: 1. Open up a Konsole (preferably minimized) and change to the following folder: (/usr/local/bin/Half-Life/hlds_l/), then run the command: startup and keep the Konsole running 2. Open up another new Konsole (preferably minimized as well) and change to the following folder (/usr/local/bin/Half-Life/hlds_l/PB/) then run the command: pb also keep the Konsole running after running the program I'd like to have this so that I can double click on the "batch file" and have it run, or if I have to run it through Konsole, I'd like as an additional step to have the Konsole that I used to run the "batch file" to close after issuing the two commands if possible. TIA Curtis _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.