View previous topic :: View next topic |
Author |
Message |
beissemj Tux's lil' helper
Joined: 10 Jan 2005 Posts: 100 Location: Orlando, FL
|
Posted: Mon Feb 14, 2005 1:24 am Post subject: Newb question! (Howto run scripts) |
|
|
This is a very simple question, but I don't know how to do it and searching has not given any useful results. I'm getting rid of some dead weight on my system, but it's quite time consuming. I've found a couple scripts to help with the process but I dont know how to run them (surely it must be easy...) how does one actually, run a script? |
|
Back to top |
|
|
polle Veteran
Joined: 28 Feb 2003 Posts: 1498 Location: Belgium
|
Posted: Mon Feb 14, 2005 1:29 am Post subject: |
|
|
chmod 755 scriptname
./scriptname |
|
Back to top |
|
|
hollerith Apprentice
Joined: 21 May 2004 Posts: 204
|
Posted: Mon Feb 14, 2005 1:36 am Post subject: Howto run scripts |
|
|
Scripts are text files. Say the script runme.bash is in your home directory and you want to run it you open a terminal window like xterm or konsole and type
It won't run unless it is executable. So you might also have to
Code: | chmod +x runme.bash |
If you want runme.bash to run every time your system starts up you'll want to
Code: | rc-update add runme.bash default | but that's another read...
You've prbably already been running scripts and you didn't know it. Such as
|
|
Back to top |
|
|
russianpirate Veteran
Joined: 26 Sep 2004 Posts: 1167 Location: Detroit, MI
|
Posted: Mon Feb 14, 2005 1:37 am Post subject: |
|
|
before u can rc-update a script.. u have to put it in /etc/init.d/
if u want it to run only for that user.. then add it to ~/.bashrc |
|
Back to top |
|
|
angoraspruce Apprentice
Joined: 08 Jan 2005 Posts: 193 Location: Minnesota, USA
|
Posted: Mon Feb 14, 2005 2:30 am Post subject: Re: Newb question! (Howto run scripts) |
|
|
Hello beissemj,
I have to say that running a script to prune the dead weight on you system is a tad dangerous if you do not know exactly what it does. As you had troubles launching it, I'm guessing that this might be the case. Proceed with caution, and if you have any files you'd miss if they were permanently gone forever and ever, back them up, preferably off of the system that you're running the scripts on.
With that stated, if you think you'd be running the scripts often, place them somewhere in your path, such as '/usr/local/bin', and do the 'chmod 755' thing that polle posted. You won't have to type the dot-slash in front of the script if it's in you path. Just type out its name.
Best regards |
|
Back to top |
|
|
transient l33t
Joined: 13 Jan 2005 Posts: 759
|
Posted: Mon Feb 14, 2005 5:13 am Post subject: |
|
|
the I think will only work if the script has as its first line. This is the case for other scripts like perl and python scripts, but Im not sure about bash, it may still run them without that line. |
|
Back to top |
|
|
MagnusBerg Guru
Joined: 07 Oct 2003 Posts: 370 Location: Burgsvik, Gotland, Sweden
|
Posted: Mon Feb 14, 2005 2:00 pm Post subject: |
|
|
# source scriptname
runs the script in the same way as if you typed it in your terminal |
|
Back to top |
|
|
beissemj Tux's lil' helper
Joined: 10 Jan 2005 Posts: 100 Location: Orlando, FL
|
Posted: Wed Feb 16, 2005 6:35 pm Post subject: |
|
|
I would tend to agree with you angoraspruce, pruning can b0rk a system pretty quickly, but a couple of the things I have found can run in pretend mode. Also, it's more curiosity than anything as far as cleaning my system goes, I don't have anything important on it, and I find the more I break my box, the more I learn about gentoo... so consider you warning heeded
Thanks btw. |
|
Back to top |
|
|
|