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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
08-31-2003, 11:03 PM
|
#1
|
LQ Guru
Registered: Dec 2002
Distribution: Gentoo!
Posts: 1,153
Rep:
|
Getting "event not found" when making scripts
I'm trying to write shell scripts but everytime I try I get and error saying "!/bin/bash: event not found" I've tried typing
!/bin/bash
#!/bin/bash
and the same thing with sh instead of bash and I always get the same errors. Am I missing something? I have install bash and I see it as an program. Thanks
|
|
|
09-01-2003, 12:34 AM
|
#2
|
Senior Member
Registered: May 2001
Location: Left Coast - Canada
Distribution: s l a c k w a r e
Posts: 2,731
Rep:
|
This happens when you create _any_ script?
|
|
|
09-01-2003, 12:45 AM
|
#3
|
Senior Member
Registered: May 2003
Location: Sydney, Nova Scotia, Canada
Distribution: slackware
Posts: 4,185
Rep:
|
output this:
ls -alc /bin/bash*
|
|
|
09-01-2003, 09:17 AM
|
#4
|
LQ Guru
Registered: Dec 2002
Distribution: Gentoo!
Posts: 1,153
Original Poster
Rep:
|
Well how do you right a script? I open a terminal and type "!/bin/bash" and I get "event not found" same with when I just type "#!/bin/bash" The mandrake howto I have has
#!/bin/bash
echo Hello World
I can't get to the Hello World part because when I hit enter I get event not found.
-rwxr-xr-x 1 root root 625516 Aug 31 11:16 /bin/bash*
lrwxrwxrwx 1 root root 4 Aug 31 11:16 /bin/bash2 -> bash*
|
|
|
09-01-2003, 12:01 PM
|
#5
|
Senior Member
Registered: Jan 2003
Posts: 2,786
|
Shell scripts are contained in text files... You don't type them on the command-line directly. Open a text editor and go to town...
The first time you try to run the script, save it, and at a command-line type:
chmod u+x filename
That will make the file executable. Then type:
./filename
That will run the script. The ./ at the beginning is to make sure the script in the current directory is run.
The "#!/bin/bash" line should be the first line in your script, and it tells the system that you want bash to interpret the commands in the file.
|
|
|
09-01-2003, 12:37 PM
|
#6
|
LQ Guru
Registered: Dec 2002
Distribution: Gentoo!
Posts: 1,153
Original Poster
Rep:
|
That works, I wasn't quite understanding how to do that but it makes sense now
|
|
|
All times are GMT -5. The time now is 12:00 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|