Find the answer to your Linux question:
Results 1 to 2 of 2
I'm getting a syntax error with this and was hoping for some help please: Code: if [[ -e $4 ] && [ "$overwrite_flag" != 0 ]] || [ -!e $4 ...
  1. #1
    Just Joined!
    Join Date
    May 2007
    Posts
    24

    Syntax Error - scripting - if conditions

    I'm getting a syntax error with this and was hoping for some help please:
    Code:
    if [[ -e $4 ] && [ "$overwrite_flag" != 0 ]] || [ -!e $4 ]
    I'm trying to say:

    (If file ($4) exists AND the overwrite flag is set) OR (If the $4 file does NOT exist) THEN ....


    Can someone please tell me what i'm doing wrong?

  2. #2
    Linux Guru anomie's Avatar
    Join Date
    Mar 2005
    Location
    Texas
    Posts
    1,692
    How about:
    Code:
    if [[ -e $4 && $overwrite_flag -ne 0 ]] || [ ! -e $4 ]
    Lots of good information at tldp on bash scripting.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...