简体   繁体   中英

Command not found

Hi i'm going to create one script (.sh or .command) my Script is

  #!/bin/bash
  echo Build Begin
  'xcrun instruments -w "iPhone 5s (8.3 Simulator)"'

i got error,

  Last login: Mon Mar 21 15:48:29 on ttys000
  MacBook-Pro:~ user$ /Users/user/CommandWorld.command ; exit;
  Build Begin
  /Users/user/CommandWorld.command: line 3: xcrun instruments -w "iPhone 5s (8.3 Simulator)": command not found
  logout

  [Process completed]

If i run command "xcrun instruments -w "iPhone 5s (8.3 Simulator)"" as it is on terminal then its worked ... but why it not in script file?

By putting the whole command inside single quotes, you make the shell assume it is a single word ; it then expects to find a command that match it, rather than the command xcrun . Remove the single quotes and you should be alright.

The double quotes are here for the same purpose (and should not be removed) : to pass "iPhone 5s (8.3 Simulator)" as a single word rather than a list of words ( iPhone , 5s , (8.3 and Simulator) ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM