Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora 17/18 > Using Fedora
FedoraForum Search

Forgot Password? Join Us!

Using Fedora General support for current versions. Ask questions about Fedora and it's software that do not belong in any other forum.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 29th May 2012, 08:11 AM
Socrates440 Offline
Registered User
 
Join Date: May 2012
Location: Aspen
Posts: 48
linuxfirefox
File execution question

Big thanks to everybody who has helped me out so far. I have a file execution question. I wrote a shell script that is one step above a "hello world!" program called firstshell.sh. Anyways, I went to the directory where firstshell.sh was with the cd command and I tried running it by typing in /firstshell.sh. My terminal returned:

@localhost Begshell]$ /firstshell.sh
bash: /firstshell.sh: No such file or directory


I typed in ls -l to make sure the file was there and my terminal confirmed that firstshell.sh was in there.

I then tried loading firstshell using @localhost Begshell]$ /home/username/Documents/Begshell/firstshell.sh and it worked.

My question is ,why couldn't I load it from the directory it was in by typing /begshell.sh?

Thanks!
Reply With Quote
  #2  
Old 29th May 2012, 08:27 AM
marriedto51 Online
Registered User
 
Join Date: Jul 2009
Location: England, UK
Posts: 821
linuxfirefox
Re: File execution question

The '/' character on the front of the path refers to the root of the filesystem.

To refer to the current directory, use a '.', as in:
Code:
$ ./firstshell.sh
Reply With Quote
  #3  
Old 29th May 2012, 08:40 AM
sonoran's Avatar
sonoran Offline
Registered User
 
Join Date: May 2005
Location: Sonoran Desert
Posts: 2,103
linuxfirefox
Re: File execution question

As marriedto51 said, you need a . before the / to indicate the current directory:
http://rute.2038bug.com/node7.html.g...00000000000000

Some people add the . to their $PATH, so bash always searches the current directory, but others say that is a security risk:
http://rute.2038bug.com/node7.html.g...00000000000000

Rute is a bit old, but a valuable resource:
http://rute.2038bug.com/index.html.gz
Reply With Quote
Reply

Tags
execution, file, question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
C program execution using gcc. surajms Using Fedora 5 12th July 2011 01:22 PM
file execution aquarianutsav Linux Chat 1 1st February 2010 03:29 PM
Execution with Cron mediator Programming & Packaging 5 3rd April 2008 02:38 PM
Help with execution code ianmac Using Fedora 3 14th April 2005 11:20 PM


Current GMT-time: 15:28 (Wednesday, 22-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat