LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 04-04-2006, 07:51 PM   #1
lonecrow
Member
 
Registered: May 2005
Location: Canada
Distribution: PCLinuxOS 2007
Posts: 274

Rep: Reputation: 30
shell script extension?


Is there a special extension I have to put at the end of my shell script so it doesnt open with something like KATE or KWRITE?

Thanks and sorry!
 
Old 04-04-2006, 08:11 PM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,372

Rep: Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381
Can you explain a bit more? Those (KATE or KWRITE) are editors, so they should(!) open any text file ...
i don't understand your problem .
 
Old 04-04-2006, 08:29 PM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
normally, you would not put any extension on a shell script. When you make it executable, then calling it (type name in terminal or click on a link icon)--it will run.
It won't open in an editor unless you tell it to....
 
Old 04-04-2006, 09:07 PM   #4
lonecrow
Member
 
Registered: May 2005
Location: Canada
Distribution: PCLinuxOS 2007
Posts: 274

Original Poster
Rep: Reputation: 30
mmmm

I know I used to be able to just click them so it runs the script, but now it opens in KWRITE. This is weird isnt it. It is like instead of running the script, the system thinks I want to edit them, but I only want to RUN them... Does that clarify a bit more?

pixellany: When you say make it executable.... what am I supposed to do?
 
Old 04-05-2006, 01:51 AM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,372

Rep: Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381
To make executable, set permission thusly:
chmod u+rx <filename>
normally shell script names end in '.sh'
Not REQD, but recommended.
 
Old 04-05-2006, 05:34 AM   #6
lonecrow
Member
 
Registered: May 2005
Location: Canada
Distribution: PCLinuxOS 2007
Posts: 274

Original Poster
Rep: Reputation: 30
will try that when I get home later on. Thanks a bunch!
 
Old 04-05-2006, 07:12 AM   #7
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Quote:
Originally Posted by lonecrow
mmmm

I know I used to be able to just click them so it runs the script, but now it opens in KWRITE. This is weird isnt it. It is like instead of running the script, the system thinks I want to edit them, but I only want to RUN them... Does that clarify a bit more?

pixellany: When you say make it executable.... what am I supposed to do?
I was a bit off in my earlier answer. A shell script is a text file and WILL open in an editor if not set up as executable.
To see how it is set: "ls -l" in the directory where the script file is.
To change it: "chmod 755 <filename>"
This is a standard command for scripts, applications, etc. It sets full privileges for root, and read and execute for everyone else.
For more details: "man chmod" and "man chown"
 
Old 04-06-2006, 06:00 PM   #8
lonecrow
Member
 
Registered: May 2005
Location: Canada
Distribution: PCLinuxOS 2007
Posts: 274

Original Poster
Rep: Reputation: 30
Fine it works now. It was a combination of both.

Need the extension .sh
and set privilege as 755

Thanks all!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
shell script problem, want to use shell script auto update IP~! singying304 Programming 4 11-29-2005 05:32 PM
Need script to add extension stefaandk Linux - General 1 10-05-2005 10:07 PM
bash script to sort files by extension otheralex Programming 7 08-19-2005 02:40 AM
PHP: GD script with a .PNG extension - Possible/How to? Adrohak Programming 0 07-28-2004 01:01 AM
distro extension script DAChristen29 Linux - General 4 01-13-2004 08:57 AM


All times are GMT -5. The time now is 07:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration