Welcome to Tech Support Forum home to more then 136,000 problems solved. Issues have included: Spyware, Malware, Virus Issues, Windows, Microsoft, Linux, Networking, Security, Hardware, and Gaming Getting your problem solved is as easy as:
1. Registering for a free account
2. Asking your question
3. Receiving an answer

Registered members:
* Get free support
* Communicate privately with other members (PM).
* Removal of this message
* See fewer ads.
* And much more..

 



Want to know how to post a question? click here Having problems with spyware and pop-ups? First Steps
Go Back   Tech Support Forum > Alternative Computing > Linux Support
User Name
Password
Site Map Register Donate Rules Blogs Mark Forums Read


Linux Support Linux - Operating Systems and Applications Support

Reply
 
LinkBack Thread Tools
Old 08-20-2008, 07:50 PM   #1 (permalink)
Registered User
 
Join Date: Aug 2008
Location: cambodia
Posts: 1
OS: XP SERVICE PACK II


Send a message via Skype™ to chhorvorn
Post How to use shell script?

my shell script is always refuse with me when I try to write it.
I don't know how to use shell script could you guid me some point.
I am very glad to see your reply.
thans
chhorvorn is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Important Information
Join the #1 Tech Support Forum Today - It's Totally Free!

TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free.

Join TechSupportforum.com Today - Click Here

Old 08-20-2008, 09:00 PM   #2 (permalink)
Manager
 
shuuhen's Avatar
 
Join Date: Sep 2004
Location: Colorado
Posts: 981
OS: Mac OS 9.1, Mac OS X 10.5.8, WinXP Pro, FreeBSD 6.0, Gentoo Linux

My System

Re: How to use shell script?

What shell is it written in? What's the exact error you get when trying to run it? Make sure it has the executable permission set for the user or group trying to run it.

There's a couple of guides to bash shell scripting on tldp.org. Check under Guides. There should be both an Advanced Bash Scripting and a Bash for Beginners.
__________________


Has it been a few days since I replied to your thread? Don't panic! I'm a busy college student and may forget a post if I'm extra busy (or it might just take me a while to be able to do a decent reply). If you still need help and are awaiting my reply after a few days, PM me about it.

When posting what errors you get, please give the full message. It makes helping you much easier.
shuuhen is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 08-21-2008, 09:04 PM   #3 (permalink)
Registered User
 
Join Date: Oct 2007
Location: Littleton, Colorado USA
Posts: 470
OS: xp 64 sp2 Fedora Core 8 (vmware xp core 8 x32) Minix


Re: How to use shell script?

Shell scripts need execute permission to run. Add "chmod +x <script.sh>" where <script.sh> is you script name. If the script is in the same directory you are trying to execute it from, you must prepend the script name with "./" or "./script.sh". The reason for this is that the current working directory (CWD) is not in the PATH as it is automatically for DOS. It is considered a security hole to have the CWD in the PATH. To see what your path is type :"echo $PATH". If you do CWD add it at the end and make it a . (dot).

You can execute a script without setting the execute bits by typing: "sh ./script.sh". This will execute it script. For debugging run it as "sh -x ./script.sh" or "sh -v ./script.sh" or "sh -vx ./script.sh". When the script is debugged move it to your ~/bin directory and add the execute bits.

The first line of the script is usually the engine that is going to run the script. If it the sh shell it is usually "#!/bin/sh". The #! IDs the file to be executed by the sh shell. Likewise for bash, csh, perl etc.

Go looking through /usr/bin at the various scripts that are there.

Hope this helps.
lensman3 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -7. The time now is 05:46 AM.



Copyright 2001 - 2009, Tech Support Forum
Home Tips Plus | Outdoor Basecamp | Automotive Support Forum

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85