• 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
Predictable do shell script command environment (was Command line text substitution)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Predictable do shell script command environment (was Command line text substitution)


  • Subject: Predictable do shell script command environment (was Command line text substitution)
  • From: Chris Janton <email@hidden>
  • Date: Sun, 19 Jan 2003 00:17:36 -0700

explain what that statement actually means. Perhaps I've got it backwards,
and in 10.1.x it was zsh emulating sh, and now in 10.2.x it's bash emulating
sh. I still don't know what that means.

On my machine - 10.2.3 - no matter what I set my default shell to in Netinfo Manager I always wind up in bash.

My test is a simple "printenv".

If you're not concerned with AppleScript here (which would be odd), or are
scripting the Terminal application, then it's tcsh for sure.

If you need portability...well maybe you mean you want consistent results. That is achieved by making the
shell script indicate which shell should execute it

#!/bin/sh
your commands
go here

So what you do is make the shell script in whichever scripting environment you need. You save in a file and make the file executable.

Then
do shell script "path-to-my-script"

Now the script works right and you probably won't care which shell you get by default from the do shell script command. of course this *is* messy...but it is the way to get things to work the way that you require.

Simple answer - if you are going to depend on some feature of a shell then you need to encapsulate that requirement in a shell script like it should be...(and PATH and CLASSPATH and on and on and on)

8)
----------------------------------
Chris Janton - face at CentosPrime dot COM
Netminder for Opus1.COM
_______________________________________________
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.

  • Prev by Date: Re: How to Set Text to Include Quotes (") ?
  • Next by Date: Re: Command line text substitution
  • Previous by thread: Re: How to Set Text to Include Quotes (") ?
  • Next by thread: On wake
  • Index(es):
    • Date
    • Thread