Re: do shell script undesired behaviour (!)
Re: do shell script undesired behaviour (!)
- Subject: Re: do shell script undesired behaviour (!)
- From: Axel Luttgens <email@hidden>
- Date: Mon, 15 Nov 2010 13:39:09 +0100
Le 15 nov. 2010 à 10:39, julifos a écrit :
> Hi all!
>
> [...]
>
> See this code:
>
> ----------------
> do shell script "cd /BAD/PATH; ls -la"
> ----------------
>
> Previously, if you concatd various commands in the same do shell script, the
> first of them causing errors would cause also an applescript error, so
> subsequent commands wouldn't be executed (in this sample, "ls -la").
>
> I think it's the same in a Terminal window, so maybe AS can't do nothing at
> this point (?)
Are you sure you aren't confusing with:
do shell script "cd /BAD/PATH && ls -la"
where one explicitly requires the first command to be successful for having the second one to be executed?
> I also noticed that now the default path in do shell script is the root:
>
> ----------------
> do shell script "pwd"
> --> "/"
> ----------------
I think this has always been the case with "do shell script"; that said, this isn't official behavior, and it is always a good idea not to rely on such behaviors.
To get a rather exhaustive idea of the environment provided by your current version of AppleScript to "do shell script", you could have a look at the output of such commands:
do shell script "set"
do shell script "echo $-" -- see the 'set' builtin fro more info
do shell script "shopt"
HTH,
Axel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden