[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bash Scripting



D-Man wrote:
  >sed  "s/Title/$TITLE/g" title.html >> file.txt &&
  >
  >Also, I'm not sure why you have double & at the end of the line.  I
  >think you want to run sed in the foreground, not the background.  I
  >don't understand what the second & does.
 
  & by itself mean s to run in the background

  && means run the next pipeline only if the current command has a zero
     exit status

  || means run the next pipeline if the current command has a non-zero
     exit status


Thus

  grep -qs 'some garbage' input_file && echo Found it || echo Not there

-- 
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47  6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "The Lord knoweth how to deliver the godly out of 
      temptations, and to reserve the unjust unto the day of
      judgment to be punished;"            II Peter 2:9 




Reply to: