![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| 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: * 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 |
|
|||||||
| Linux Support Linux - Operating Systems and Applications Support |
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) |
|
Registered User
|
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 |
|
|
|
| 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 |
|
|
#2 (permalink) |
|
Manager
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
|
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. |
|
|
|
|
|
#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. |
|
|
|
![]() |
| Thread Tools | |
|
|