Monday 15 February 2010

bash - Pass in variable from shell script to applescript -


I have a shell script that I call which uses osascript And he calls OSScript a shell script and passes it into a variable that I have set in the original shell script. I do not know how to pass the Wealab from the Sailescript to the Shell script.

How can I do this from shell script to celli script in a celli ...?

Let me know if I can not understand.

  i = 0 line $ (system_profiler SPUSBDataType | sed -n -e '/ ipad /, / serial / p' -e '/ iPhone /, / serial / p' | grep " Serial Number: "| awk -F": "'{print $ 2}'); UDID = $ {line} echo $ UDID #i = $ ((i $ 1 +) Sleep 1 OS-script- 'Terminal "keystroke" to be told the application "by using the' command down ' To apply 'e' spread 'cd' $ current_dir ', tell the application "terminal" in the selected tab in the front window' api 'script to tell the application "terminal" ./script.sh ip_address' $ { # UDID} '& amp; In the selected tab of the front window,' done '   

Shell variable single Quotation does not extend in. When you want to pass the shell variable from osascript , then you have to use the double code "" quotation marks. The problem is that you have the oscript You must avoid the required double quotes inside, such as:

script

  says "hello" using "Alex"   < P> You need escape quotes  
  text = "hello" osascript -e "\" Alex \ ""   

Is not very readable, so Bash's heredoc is better to use the facility, such as

  text = "Hello World" Osskript & lt; & Lt; Using "EOF" Alex "EOF" "$ text" and you can write multiline script for free, it is much better than using multiple code.   

No comments:

Post a Comment