• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Shell problems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Shell problems


  • Subject: Shell problems
  • From: Reinhold Penner <email@hidden>
  • Date: Sun, 8 Sep 2002 09:43:04 -1000

I seem to be having problems with a shell command in a do shell script. So this works in the Terminal:

if (-e '/path2file1') cp -f '/path2file1' '/path2file2'

it will copy a file (path2file1) if that file exists and will do nothing if it doesn't. As soon as I pack the above into a do shell construct:

do shell script "if (-e '/path2file1') cp -f '/path2file1' '/path2file2'"

I will get an error < sh: -c: line 1: syntax error near unexpected token `cp' >

What am I doing wrong and is there another, maybe smarter, way to find out if a file exists and if so act upon it?

-Reinhold
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Shell problems
      • From: John Delacour <email@hidden>
  • Prev by Date: Re: Script Editor problem in 10.2
  • Next by Date: Using Quark Dictionary Words in a List
  • Previous by thread: Re: Script Editor problem in 10.2
  • Next by thread: Re: Shell problems
  • Index(es):
    • Date
    • Thread