LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-06-2003, 11:39 AM   #1
bryantm3
LQ Newbie
 
Registered: Dec 2003
Posts: 1

Rep: Reputation: 0
how do you open .sh files?


i try to open them in the terminal but it gives me this line of code:
Code:
[tnayrbleinad@ga-cmng-cuda2-c1a-a-141 tnayrbleinad]$
what the fuck am i supposed to do?

Last edited by bryantm3; 12-06-2003 at 11:40 AM.
 
Old 12-06-2003, 11:45 AM   #2
teval
Member
 
Registered: Jul 2003
Location: Toronto, Canada
Distribution: Gentoo
Posts: 720

Rep: Reputation: 30
sh files are shell scripts (well any file can be a shell script, the fact that it sends in .sh makes it certain, but they don't have to)

The shell script just might be doing something that you can't see.
What does

cat <file>

Give you, replacing <file> with your script.
 
Old 12-06-2003, 11:54 AM   #3
TheOneKEA
Member
 
Registered: Oct 2003
Distribution: Debian GNU/Linux 11 (amd64) w/kernel 6.0.15
Posts: 299

Rep: Reputation: 30
Or you can do:

head --lines=1 <file>

and see what the magic interpreter specification is supposed to be. If it's something like /bin/sh, then execute the following command:

/bin/sh <file>
 
Old 12-06-2003, 12:11 PM   #4
Faecal
Member
 
Registered: Sep 2002
Location: York, UK
Distribution: Debian Sid
Posts: 215

Rep: Reputation: 30
>[tnayrbleinad@ga-cmng-cuda2-c1a-a-141 tnayrbleinad]$
That's no kind of code: that's just your prompt. Rather a long one, due to the long username and hostname.

.sh files are to be executed by first doing "chmod +x <filename>" and then "./<filename>"
 
Old 12-06-2003, 12:36 PM   #5
shanenin
Member
 
Registered: Aug 2003
Location: Rochester, MN, U.S.A
Distribution: Gentoo
Posts: 987

Rep: Reputation: 30
I wanted to get my firewall script(shellscript) to run at bootup. I stuck in this file like this. Did I do this the right way. my question is putting a sh in front of the file anothr way to run a shellscript
Code:
# /etc/conf.d/local.start:
# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/conf.d/local.start,v 1.4 2002/11/18 19:39:22 azarah Exp $

# This is a good place to load any misc.
# programs on startup ( 1>&2 )
sh /etc/rc.firewall
it seems to be working ok

Last edited by shanenin; 12-06-2003 at 12:44 PM.
 
Old 12-06-2003, 04:38 PM   #6
Faecal
Member
 
Registered: Sep 2002
Location: York, UK
Distribution: Debian Sid
Posts: 215

Rep: Reputation: 30
Yes, that's fine. On most linux systems, sh gets you /bin/sh, which is a symlink to /bin/bash. So what you're doing there is invoking bash, and passing it a script. The same thing happens if you make the file executable and run it, due to the magic "#!/bin/bash" that you'll find at the top of most shell scripts.
 
  


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
How to open .7z files john0908 Linux - Software 4 08-11-2006 05:11 AM
Open Office does not open large files linuxfond Linux - Newbie 8 09-26-2004 03:46 AM
How do I open .bi files aarond Linux - Software 3 07-12-2004 06:20 PM
Can Open Office open WordPerfect files hemenm Linux - Software 2 03-10-2004 05:14 PM
Too many files open cic Linux - General 1 02-07-2002 04:18 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:45 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