LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to do scripts in Linux (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-do-scripts-in-linux-457656/)

Tha1 06-23-2006 04:07 PM

How to do scripts in Linux
 
Hey,long time no see.
My question is this:how do I do scripts in Linux?
I'm trying to automate my Arch linux installation, so that i don't have to type all the lines needed to install packages (for example, vlc and gnome).
Also, from googling, I realized that the language is PHP, but I'm actually not sure, I hope that you can clarify me on that as well.

Sorry for the bad english

Cheers

bulliver 06-23-2006 04:14 PM

Quote:

Also, from googling, I realized that the language is PHP
I don't think so. PHP is generally run through a webserver. Yes, there is a CLI version, but it is not installed with Arch by default.

If you simply want to automate a bunch of commands and run them consecutively just do something like:
Code:

#!/bin/bash

pacman -S package1
pacman -S package2
pacman -S package3

etc etc...

If you need to do anything a bit trickier then I suggest taking a look at "The Advanced BASH Scripting Guide". Too lazy to find a link just now but have a google.

If you know Perl or Python I think they will be installed by default.

BobNutfield 06-23-2006 04:14 PM

Arch has a very good package manager called pacman. Check out the Arch Wiki for a complete description..

http://wiki.archlinux.org/index.php/Main_Page

Hope this helps

Bob

Tha1 06-23-2006 05:43 PM

Quote:

Originally Posted by bulliver
I don't think so. PHP is generally run through a webserver. Yes, there is a CLI version, but it is not installed with Arch by default.

If you simply want to automate a bunch of commands and run them consecutively just do something like:
Code:

#!/bin/bash

pacman -S package1
pacman -S package2
pacman -S package3

etc etc...

If you need to do anything a bit trickier then I suggest taking a look at "The Advanced BASH Scripting Guide". Too lazy to find a link just now but have a google.

If you know Perl or Python I think they will be installed by default.

How can I specify in the script that I what a certain package and all of its dependencies installed?

bulliver 06-23-2006 05:54 PM

Quote:

How can I specify in the script that I what a certain package and all of its dependencies installed?
Pacman will install any deps for "foo" automatically when you "pacman -S foo"

Tha1 06-23-2006 06:14 PM

Quote:

Originally Posted by bulliver
Pacman will install any deps for "foo" automatically when you "pacman -S foo"

What I mean is: when i install normally, he presents me the dependencies and asks me if i want them installed, and if not, asks me for each one of the dependencies.
Do I need to specify it in the script, so that he doesn't ask me that,just installs it?

bulliver 06-23-2006 06:23 PM

Quote:

What I mean is: when i install normally, he presents me the dependencies and asks me if i want them installed, and if not, asks me for each one of the dependencies.
Right, sorry, I see what you mean. "man pacman" shows a "--noconfirm" option that apparently skips all the "Are you sure" prompts. I am not sure if this will fully work for your purposes but maybe...I am not near my Arch box to test.

Tha1 06-24-2006 09:20 AM

Ok, i'll give it a try later. Thanks for the help!! :)


All times are GMT -5. The time now is 06:30 AM.