LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-12-2014, 08:16 PM   #1
AlexBB
Member
 
Registered: Mar 2014
Posts: 437

Rep: Reputation: Disabled
What does it mean in GFortran?


if [ $? -ne 0 ]; then. What does -ne mean? And why is there a semicolon inside? The expression seems to be from a command line argument. You can find a links for fftpack5_prb.sh in the middle of the page. Can anybody interpret it all. Thanks.

Last edited by AlexBB; 12-13-2014 at 10:24 AM.
 
Old 12-12-2014, 08:39 PM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 2,445

Rep: Reputation: Disabled
fftpack5_prb.sh is a shell script, not a program written in GFortran.

The -ne comparison operator means "not equal to". The semicolon after the closing bracket is part of the syntax for an if statement in most shells:
Code:
if [ condition ]; then statement(s) ; fi
The $? shell variable contains the exit code for the last command/executable that was run. An exit code of 0 indicates that the program/command completed without errors. In other words, the if statement seems to say: "if the previous program encountered an error and returned a non-zero exit code, do [whatever comes after then]".
 
1 members found this post helpful.
Old 12-13-2014, 10:23 AM   #3
AlexBB
Member
 
Registered: Mar 2014
Posts: 437

Original Poster
Rep: Reputation: Disabled
Thanks. I thought it was a command line argument for a Fortran run main or something. Is it a command line written in shell script? If so where can I read about it?
 
Old 12-13-2014, 10:29 AM   #4
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,465

Rep: Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069Reputation: 2069
fftpack5_prb.sh is a bash script, indicated by both the filename extension and the "#!/bin/bash" at the top of the script.

Code:
if [ $? -ne 0 ]; then
   do something
fi
is standard bash syntax for checking the exit status of the previously-executed command. If the exit status is not 0, then it does something in response, usually printing an error and exiting.
 
1 members found this post helpful.
Old 12-13-2014, 12:43 PM   #5
AlexBB
Member
 
Registered: Mar 2014
Posts: 437

Original Poster
Rep: Reputation: Disabled
suicidaleggroll, thank you. As always you are on top of the game!!!
 
  


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
gfortran for SLES 11 mahdi109 Linux - Software 3 06-03-2012 10:39 AM
gfortran download elnaz Programming 4 11-06-2009 08:49 AM
ifort and gfortran hanamilani Linux - Software 1 02-15-2009 12:34 PM
help gfortran mperez Programming 2 12-16-2007 12:50 PM
gfortran and pgf90 peeInMyPantz Programming 1 08-08-2005 04:54 AM


All times are GMT -5. The time now is 01:38 AM.

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