Re: tiny quick newbie question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2003-07-15 at 15:51, Logan Linux wrote:
> This helps how?

aargh!!! don't know what happened there...  lets see if its still in my
sent box... here we go again :)

On Tue, 2003-07-15 at 15:15, Logan Linux wrote:
> I am trying to create a database "automatically" with some sort of
script.
> I have a file with a .sql extension and it contains the relevant "make
the 
> database" info in it.
> How do I execute this?

There are two things you may have to address here: 1. path, and 2.
permissions.

1. Shells generally look at the environment variable $PATH (you can type
'echo $PATH') and if the current directory (also known as '.') isn't in
there then anything in the current directory won't be executed.  To get
around this, you can add '.' to your path (type 'export PATH=$PATH:.')
or run the script as follows: './script.pl' or './script.sh'

2. For a file to be executed in the above manner, you have to make sure
the permissions for the file have the 'executable bit' set.  Permissions
come in three basic sets: 'user', 'group' and 'other'.  user refers to
the owner of the file, group refers to anyone in the group the file is
in, and other refers to everyone else.  To make a file executable for
any of these sets, you set the executable bit for that set of users.

'man chmod' for some more info

but, for example, to give everyone permission to execute a file, you
would type 'chmod a+x script.sh'.  If you type 'ls -al script.sh' you'll
then see something like
-rwx--x--x  1 iain  iain  655 Jun 24 11:01 script.sh
^          directory?
 ^^^       user
    ^^^    group
       ^^^ other
and the rest of the line displays the actual owner, group, and some
other info.

This particular example shows that the owner (iain) can read (r), write
(w), and execute (x) the file, and everyone else can only execute (--x)
it.  Note that 'x' is no good without 'r'.

> Im having trouble with "executions" since my move from w32.
> 
> If a file has extension .pl, it is a perl script and you can run
> 
> perl -e script.pl

If the file is not executable you can do this, otherwise you could just
say './script.pl'

> right?
> 
> I still have to use
> sh script.sh to run an .sh file. I thought it was possible to just
type the 
> name of the file if it was a .sh file

This is very basic, there are lots of other things you will discover by
playing around, but I hope this gets you on the way!
-- 
Iain Buchanan <iain@xxxxxxxxxxxxxxxxxxx>
Q:	What's a light-year?
A:	One-third less calories than a regular year.

Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [Fedora Users]     [Centos Users]     [Kernel Development]     [Red Hat Install]     [Red Hat Watch]     [Red Hat Development]     [Red Hat Phoebe Beta]     [Yosemite Forum]     [Fedora Discussion]     [Gimp]     [Stuff]     [Yosemite News]

  Powered by Linux