LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 03-07-2014, 08:11 AM   #16
mirage1993
Member
 
Registered: Feb 2014
Location: China
Distribution: CentOS6.4
Posts: 51

Original Poster
Rep: Reputation: Disabled

Quote:
Originally Posted by suicidaleggroll View Post
You can return any number between 0-255
oh ...yes ...we often use 0 and 1.
 
Old 03-07-2014, 08:12 AM   #17
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
You can return any value from 0-255; I don't think you can return negative numbers, nor numbers larger than 255.
 
1 members found this post helpful.
Old 03-08-2014, 03:05 AM   #18
mirage1993
Member
 
Registered: Feb 2014
Location: China
Distribution: CentOS6.4
Posts: 51

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rtmistler View Post
You can return any value from 0-255; I don't think you can return negative numbers, nor numbers larger than 255.
if I return a negative number,it may display error information.But if I return 777,it would return 9 in fact .Because the Exit code is limited to 8 bits,so it's 00001001 rather than 1100001001...
 
Old 03-08-2014, 12:33 PM   #19
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
Here is some proof of my grep claims.

Code:
## 'found' exit status
# grep -i 'end' text.txt
bend over linux
# echo $?
0

## 'not found' exit status
# grep -i 'asdf' text.txt 
# echo $?
1

## 'error' exit status
# grep -i82934rj 'enddasdf' text.txt 
grep: invalid option -- 'j'
Usage: grep [OPTION]... PATTERN [FILE]...
Try 'grep --help' for more information.
# echo $?
2
 
1 members found this post helpful.
  


Reply

Tags
shell script



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
Shell Script to take 2 inputs and process the result shadownet Linux - Newbie 3 05-24-2013 12:58 PM
[SOLVED] Shell Script - Getting an argument from ps result sajjadshahid Linux - Newbie 3 01-10-2012 01:10 AM
Formatting result file using Shell script athreyavc Programming 3 09-22-2008 05:57 AM
I wanted to run my sql program in my shell script? anandv_1234 Linux - Newbie 2 02-25-2008 06:12 PM
Shell script to cd into the result of Find odinsride Programming 5 10-17-2007 10:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:29 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
Open Source Consulting | Domain Registration