Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Newb question! (Howto run scripts)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
beissemj
Tux's lil' helper
Tux's lil' helper


Joined: 10 Jan 2005
Posts: 100
Location: Orlando, FL

PostPosted: Mon Feb 14, 2005 1:24 am    Post subject: Newb question! (Howto run scripts) Reply with quote

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 :oops: (surely it must be easy...) how does one actually, run a script?
Back to top
View user's profile Send private message
polle
Veteran
Veteran


Joined: 28 Feb 2003
Posts: 1498
Location: Belgium

PostPosted: Mon Feb 14, 2005 1:29 am    Post subject: Reply with quote

chmod 755 scriptname
./scriptname
Back to top
View user's profile Send private message
hollerith
Apprentice
Apprentice


Joined: 21 May 2004
Posts: 204

PostPosted: Mon Feb 14, 2005 1:36 am    Post subject: Howto run scripts Reply with quote

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
Code:
./runme.bash


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

Code:
emerge


Code:
genkernel all
Back to top
View user's profile Send private message
russianpirate
Veteran
Veteran


Joined: 26 Sep 2004
Posts: 1167
Location: Detroit, MI

PostPosted: Mon Feb 14, 2005 1:37 am    Post subject: Reply with quote

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
View user's profile Send private message
angoraspruce
Apprentice
Apprentice


Joined: 08 Jan 2005
Posts: 193
Location: Minnesota, USA

PostPosted: Mon Feb 14, 2005 2:30 am    Post subject: Re: Newb question! (Howto run scripts) Reply with quote

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
View user's profile Send private message
transient
l33t
l33t


Joined: 13 Jan 2005
Posts: 759

PostPosted: Mon Feb 14, 2005 5:13 am    Post subject: Reply with quote

the
Code:
./scriptname
I think will only work if the script has
Code:
#!/bin/bash
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
View user's profile Send private message
MagnusBerg
Guru
Guru


Joined: 07 Oct 2003
Posts: 370
Location: Burgsvik, Gotland, Sweden

PostPosted: Mon Feb 14, 2005 2:00 pm    Post subject: Reply with quote

# source scriptname
runs the script in the same way as if you typed it in your terminal
Back to top
View user's profile Send private message
beissemj
Tux's lil' helper
Tux's lil' helper


Joined: 10 Jan 2005
Posts: 100
Location: Orlando, FL

PostPosted: Wed Feb 16, 2005 6:35 pm    Post subject: Reply with quote

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 :wink:

Thanks btw.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum