LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 08-09-2016, 05:26 AM   #1
dudengke
LQ Newbie
 
Registered: May 2016
Posts: 14

Rep: Reputation: Disabled
bash: shopt -s lastpipe case errors


My file contain:
Code:
shopt -s lastpipe
exit 142 | false
echo $? -- ${PIPESTATUS[@]}
I run command: /bin/bash myfile
It output:
Code:
Hangup | false
129 -- 142 129
The correct should:
Code:
1 -- 142 1
When I run the above line by line in shell, it was correct.
why run it on a file, it failed?

Last edited by dudengke; 08-10-2016 at 03:07 AM.
 
Old 08-09-2016, 05:59 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 8,104

Rep: Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267
would be nice to explain what you have executed line by line, not only the commands, but the results too.
you made at least a mistake in the first line (lastpipt is incorrect), anyway I do not really understand what did you try.
 
Old 08-09-2016, 11:36 AM   #3
dudengke
LQ Newbie
 
Registered: May 2016
Posts: 14

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by pan64 View Post
would be nice to explain what you have executed line by line, not only the commands, but the results too.
you made at least a mistake in the first line (lastpipt is incorrect), anyway I do not really understand what did you try.
Sorry, it is: shopt -s lastpipe
 
Old 08-10-2016, 03:09 AM   #4
dudengke
LQ Newbie
 
Registered: May 2016
Posts: 14

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by pan64 View Post
would be nice to explain what you have executed line by line, not only the commands, but the results too.
you made at least a mistake in the first line (lastpipt is incorrect), anyway I do not really understand what did you try.
Hi pan64

Thanks first! I just want to know why run above in a file, it would report

Code:
Hangup | false
I was testing the behave of shopt command.

//dudengke
 
  


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
[SOLVED] Bash: Checking for lower case and upper case letters in a string fatalerror0x00 Programming 1 12-09-2012 03:17 AM
What is use of shopt command suboss87 Linux - General 2 08-30-2012 10:09 PM
Bash: change case graemef Programming 9 04-06-2010 09:48 PM
bash shopt -s not working for nocaseglob linuxcrazyguy Linux - Software 4 03-17-2007 04:05 PM
shopt command in zsh burninGpi Linux - Software 2 05-18-2006 10:22 PM


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