LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices


Reply
  Search this Thread
Old 07-24-2004, 01:43 AM   #1
1337 Twinkie
Member
 
Registered: Jul 2004
Distribution: Fedora Core 2
Posts: 79

Rep: Reputation: 15
Question runing .out files What Gives?


Ok, just for kicks, I wrote a "helloworld.cpp" app and compiled it with G++ (like I have dozens of times before). Then, when I went to execute the a.out file generated, ERROR!. What's up? I had typed "a.out" in the console, just like every other time before. Only this time, it spat out an error saying that "a.out is not a recognized command". I tried ./ a.out (because some other executables require that syntax). No dice. sh- a.out, bubkiss. Being Root had no impact, either. I have made and executed .out files like this dozens of times in the past, on earlier versions of RedHat and with OSX. What gives?
 
Old 07-24-2004, 07:05 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677
Is the file's executable bit set? If so, was it ./a.out that you typed in? or ./<space>a.out as in your message.

How is the partition containing the a.out file mounted? If it is a partition mounted with the noexec option, you wont be able to execute it.

If you type 'file a.out', what is the response?

Touch a source file and type in 'make helloworld'. Can you execute the ./helloworld program?

Last edited by jschiwal; 07-24-2004 at 07:07 AM.
 
Old 07-24-2004, 04:44 PM   #3
1337 Twinkie
Member
 
Registered: Jul 2004
Distribution: Fedora Core 2
Posts: 79

Original Poster
Rep: Reputation: 15
Lightbulb got it to work (sort of)

Yes, it was "./<space>a.out" that I had typed. I retyped without the space and it worked. So, what exactly does "./" (no space) mean as opposed to "./ " (space)? Also, what is an "executable bit"?

As for your other questions, I don't know how the filesystem was mounted, or how to check this. The .out file is in a subdirectory of my limited-user "home" folder, if that helps. The file itself has "execute" enabled on everything in its "permissions" tab. And, when I type "file a.out", I get this:

a.out: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked (uses shared libs), not stripped

The program stil does not run by just typing "a.out", though, like identical ones have on other machines and OS's.
 
Old 07-26-2004, 11:14 PM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677
If you type ls -l a.out, a long directory listing of the file will be printed. Part of the line will contain something like rwxr-xr-x. r for read, w for write, x for executable. These are the permissions for the file. The first three bits rwx are for the user ( the user who owns the file ), the second set of permissions is the group permissions. The last one is for everyone else (other). You use the chmod command to change the permissions on a file.

Adding ':.' to the end of the $PATH variable would allow executing files in the current working directory. However it can be dangerous to include the current path in the path variable. Not allowing it prevents accidents if someone has a file saved in the current directory by the same name as a system command.

The current directory is refered to as '.' .
The parent directory is refered to as '..' .
So ./a.out is saying to execute the a.out command in the current directory.
 
Old 07-27-2004, 12:00 AM   #5
1337 Twinkie
Member
 
Registered: Jul 2004
Distribution: Fedora Core 2
Posts: 79

Original Poster
Rep: Reputation: 15
Thumbs up

I guess I shouldn't save any files named "rm -rf /"? Oh well, I guess you can't have it all. ^_^

Really, though, this was a great help. Thanks a lot!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Runing commands in the background juanb General 4 09-22-2005 09:53 AM
how to know shorewall is runing? shams Fedora 2 12-26-2004 10:41 AM
help runing a java program matt_w_lambert Programming 4 10-31-2003 11:42 AM
How to make bind9 runing? beyond_2000 Linux - Networking 6 01-16-2003 01:05 AM
Maya runing faild! beyond_2000 Linux - Software 2 10-13-2002 12:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora

All times are GMT -5. The time now is 09:36 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration