LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-05-2010, 02:20 PM   #16
genderbender
Member
 
Registered: Jan 2005
Location: US
Distribution: Centos, Ubuntu, Solaris, Redhat
Posts: 396

Original Poster
Rep: Reputation: 31

Quote:
Originally Posted by ntubski View Post
From a few tests I ran, it seems that "last command" refers only to commands in the body of the loop (i.e. COMMANDS). I think the easiest way to solve this problem is to use a
Cool - I'll giuve that a shot and let you know how I get on

Thanks for your help
 
Old 11-06-2010, 03:25 AM   #17
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by genderbender View Post
pipestatus was always 0
All its values were 0 (it's an array)?
 
Old 11-08-2010, 04:37 AM   #18
genderbender
Member
 
Registered: Jan 2005
Location: US
Distribution: Centos, Ubuntu, Solaris, Redhat
Posts: 396

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by ntubski View Post
Code:
$ help for
for: for NAME [in WORDS ... ] ; do COMMANDS; done
...
    Exit Status:
    Returns the status of the last command executed.
From a few tests I ran, it seems that "last command" refers only to commands in the body of the loop (i.e. COMMANDS). I think the easiest way to solve this problem is to use a flag variable:
Code:
status=1
for uuid in ...
	do
		for snapshotuuid in ...
		do
			revert $uuid to $snapshotuuid && status=0
		done;
	done;

exit $status
Worked an absolute treat, thanks
 
  


Reply

Tags
grep forloop


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
[SOLVED] How to compile .jar Java byte-codes into native machine codes? ilgaar Linux - Software 1 08-30-2010 12:52 AM
How to compile .jar Java byte-codes into native machine codes? ilgaar Linux - Software 6 08-28-2010 11:20 PM
httpd error codes and custom error messages ninja master Linux - Software 1 01-02-2010 03:56 PM
Error codes ReV0h Linux - Newbie 2 03-14-2006 04:03 PM
Are the hex codes for colors in a jpg the same codes as used in html? abefroman Linux - Security 3 07-31-2005 03:21 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:08 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