On Monday 07 August 2006 19:57, Ryan Dillinger wrote:
> Hello All,
> I just recently loaded linux onto my laptop. I hope this was not a bad
> move. But I cannot find the Activstate Perl I downloaded.I am using
> openSUSE Linux.

You almost certainly have Perl already installed.  Open any of the terminal 
programs and run "perl -v" and it will tell you the version.  Run "which 
perl" and it will give you the proper path for your shebang line.  (It 
probably IS /usr/bin/perl but that will tell you for sure.

> I also am having trouble deciding which is the command line to open my
> scripts.
> There is the : Gnome Terminal, the Konsole, the x Terminal, and the
> Terminal Program - Super
> User Mode. Don't think it's that one for sure!

You only want to use root (Super User Mode) when necessary, such as when 
you're updating your system or installing new software.  The others are all 
just variations of the same.  You can use any one of them.  There are some 
differences in the window that runs the shell.  For instance, some of them 
might let you have multiple shells open and use tabs to switch between them.  
But the actual command line interpreter should be the same between them.  
(There are actually other command line interpreters, or shells, but the 
default is usually a shell called bash.)

> I typed in the shebang line 
> as such #!/usr/bin/perl
> then hit enter, after that I just type the name of the file.pl in. 

You don't use a shebang line at a command prompt.  If you write a script, you 
put the shebang line as the first line of the script.  Then, you can set the 
script as an executable by using the chmod (change mode) program.  Do 
a "chmod u+e myscript"  This says to add the executable attribute to the 
permissions of the user who own the file.  You can then execute the program 
simply by typing its name on the command line, just as you would any other 
program.  (But see below for paths!)  If you do not have the shebang line in 
the file or you do not have the executable permissions set, you can run the 
program by directly invoking the perl interpreter by running "perl myscript"  

> Is there 
> any basic info on just what
> needs to be done in regards to saving a file to where, then opening it up
> at the command line?
> I would greatly appreciate it.   Thank you!!

You can save the file anywhere you have permissions.  It's probably typical to 
save them either in your home directory ( /home/login, where "login" is your 
actual login name) or some subdirectory under it.  To execute the script, you 
either have to have the directory in your $PATH statement, or you have to 
specify the full path to the script.  This is even if you're IN the directory 
where the script is stored.  Unlike some other OS's, Linux usually doesn't 
have the local directory in the path statement.  So if you have your scripts 
stored in /home/login/scripts and you're in that directory, you'll still 
likely have to type "/home/login/scripts/myscript" or, more 
compactly, "./myscript" to run myscript.  The "./" is shorthand for "the 
directory I'm currently in."

And don't forget to either set the executable attribute and add a shebang line 
or to call the perl interpreter directly.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


  • Re: Linux Eric Krause
    • Re: Linux Daniel D Jones

Reply via email to