LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Puppy
User Name
Password
Puppy This forum is for the discussion of Puppy Linux.

Notices


Reply
  Search this Thread
Old 12-08-2014, 05:08 PM   #16
Fixit7
Senior Member
 
Registered: Mar 2014
Location: El Lago, Texas
Distribution: Ubuntu_Mate 16.04
Posts: 1,374

Original Poster
Rep: Reputation: 169Reputation: 169

I was mistaken in that the script can be run without the .sh extension.

Maybe there are certain directories where scripts do not need an extension in order to run ?

This is one example of a script that has no extension.

Quote:
/usr/bin/pburn
Quote:
# dirs
~
# Find_File.sh Blank.sh
/mnt/sda2/root/Tahr_Scripts/Blank.sh
/root/Scripts/Blank.sh
 
Old 12-08-2014, 05:38 PM   #17
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
If your file is named myscript.sh you have to call it with myscript.sh.
If the name is myscript you call it with myscript.

The only way to call myscript.sh without the ".sh" is to create an alias or symbolic link where you map myscript to myscript.sh.

It is irrelevant where the executable is located. There is no magic location or path which allows for calling a file without its extension.

jlinkels
 
Old 12-08-2014, 07:01 PM   #18
Fixit7
Senior Member
 
Registered: Mar 2014
Location: El Lago, Texas
Distribution: Ubuntu_Mate 16.04
Posts: 1,374

Original Poster
Rep: Reputation: 169Reputation: 169
That's good to know.

I can rename it without the extension.

I prefer leaving the extension as it immediately shows the file type.
 
Old 12-08-2014, 07:08 PM   #19
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Quote:
Originally Posted by Fixit7 View Post
I prefer leaving the extension as it immediately shows the file type.
Yes, that is my preference as well. However for some of these scripts I forget to add the .sh extension 9 times out of 10. I consider to create a symbolic link in the same directory to that file so at least my command doesn't fail anymore.
Code:
ln -s myscript.sh myscript
That executes myscript.sh even if I call myscript.

jlinkels

Last edited by jlinkels; 12-08-2014 at 07:09 PM.
 
Old 12-08-2014, 11:24 PM   #20
Fixit7
Senior Member
 
Registered: Mar 2014
Location: El Lago, Texas
Distribution: Ubuntu_Mate 16.04
Posts: 1,374

Original Poster
Rep: Reputation: 169Reputation: 169
No need to worry about the .sh extension.

Add this to your desktop. :-)

Quote:
#!/bin/bash
#
#
#
#
clear
 
  


Reply



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
Electric Shaver with Replaceable Batteries? hydraMax General 6 01-11-2012 11:15 PM
shell getopts: opt w/ optional parameter is taking next opt as its parameter! GrapefruiTgirl Programming 22 10-27-2010 06:00 AM
LXer: No Operating System is Replaceable LXer Syndicated Linux News 0 07-27-2010 02:10 PM
linux bash - how to use a dynamic parameter in shell parameter expansion expression nickleus Linux - General 2 08-21-2006 04:54 AM
Is my CPU replaceable/upgradeable (not Linux-specific) nickj6282 General 2 05-08-2006 06:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Puppy

All times are GMT -5. The time now is 03:49 PM.

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
Open Source Consulting | Domain Registration