compressing code onto one line

hi,

i am trying to rewrite some of my code onto one line. but it's not working.

what's happening is that the program exits and doesn't execute any of the code that follows.

did i make a mistake? i'm guesssing that there is something wrong with my final, "&& exit".

or is possible that spaces can be positioned in such a way that it messes up the logic?

this works:

  if [ -f list_dirty ]; then
    sort -u list_dirty > list_clean
    print "A clean user file was created"
  else
    print "The user file was not created"
    exit 1
  fi

... some other code gets executed

this doesn't:

  [ -f list_dirty ] && sort -u list_dirty > list_clean || print "The user file was not created" && exit 1

... some other code doesn't get executed

thanks for your help.

try doing this

[ -f list_dirty ] && sort -u list_dirty > list_clean || (print "The user file was not created" && exit 1)