Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
04-06-2008, 08:22 AM
|
#1
|
LQ Newbie
Registered: Mar 2008
Posts: 13
Rep:
|
how to make any file executable
ok i read that it is made by command chmod + x<filename>
but take a look at this program in perl
!/usr/bin/Perl -w
author:
modified by:
date:
Purpose: Hello World
print "hello world";
END
now first i typed this, now how will i make this file executable, do i have to first write this piece of code and then enter and then that chmod thing, well that didn’t work......... plzzzz help
|
|
|
04-06-2008, 08:27 AM
|
#2
|
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
You left out the octothorpe character and tried to run comments.
|
|
|
04-06-2008, 08:42 AM
|
#3
|
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809
|
Quote:
Originally Posted by jschiwal
You left out the octothorpe character and tried to run comments.
|
That is a marvelous word!!! I lived for over 60 years before learning it--and then I had to come to LQ to do so.
On the off chance that OP does not know what it means, we're looking for this:
#!/usr/bin/Perl -w
(And add # to all the lines which are not legal commands.)
|
|
|
04-06-2008, 08:43 AM
|
#4
|
LQ Newbie
Registered: Mar 2008
Posts: 13
Original Poster
Rep:
|
hey look man i a, just a newbie jschiwal and u were way over my head plz tell me the exact procedure, if u could........... thanx
|
|
|
04-06-2008, 09:07 AM
|
#5
|
LQ Newbie
Registered: Mar 2008
Posts: 13
Original Poster
Rep:
|
hey plz note there is indeed a # before every line........
plz tell me when should i use chmod thing before or after or when and exactly how
|
|
|
04-06-2008, 09:15 AM
|
#6
|
Member
Registered: Mar 2008
Distribution: Gentoo, CentOS, Fedora, Arch
Posts: 231
Rep:
|
Create the script, save it, run chmod +x your_script, run with ./your_script, where's the problem?
|
|
|
04-06-2008, 01:53 PM
|
#7
|
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809
|
Quote:
Originally Posted by kratosal
hey plz note there is indeed a # before every line........
plz tell me when should i use chmod thing before or after or when and exactly how
|
The "#" denotes a comment---if there is a "#" on every line, then nothing will execute.
The "#!" has to be on the first line to tell the system what language is used to interpret the script.
chmod is used to change permissions on an existing file---i.e. you first create the file, then you set the permissions.
What books have you read on all this? Now might be the time to go to http://tldp.org and get Bash Guide for Beginners, or the Advanced Bash Scripting Guide.
|
|
|
04-06-2008, 02:10 PM
|
#8
|
Member
Registered: Apr 2008
Posts: 100
Rep:
|
#!/usr/bin/perl
Quote:
i read that it is made by command chmod + x<filename>
|
Remove the space between the '+' and the 'x' and use a space between 'x' and filename:
Code:
chmod +x <filename>
chmod a+x <filename> # better, as more specific
Your script will fail even so: it has a bad she-bang line and a couple non-statement lines uncommented.
Do:
Code:
#!/usr/bin/perl
print "Hello World\n"
Bye,
M
Linux Archive
Last edited by marquardl; 05-01-2008 at 01:37 AM.
|
|
|
04-08-2008, 03:50 AM
|
#9
|
LQ Newbie
Registered: Mar 2008
Posts: 13
Original Poster
Rep:
|
hey thanx to all for ur kind help
|
|
|
All times are GMT -5. The time now is 09:48 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|