开发者

xcode/bash: Trying to redirect piped content to a file

Hi I'm using a user script in xcode to do some work for me. The first part开发者_如何转开发 of the script needs to take the piped content of the selected file and store it in a temp file. Doing some reading on redirects I found this:

#!/bin/bash
/Users/derek/projects/Crema/Classes/CoffeeFormController.m.uncrustify<&0

My understanding is that it should take all the piped in content and store it in the file The Xcode user script is set to pass the Entire Document to the script so this is effectively storing the current version of the file, regardless of whether the user has saved it or not.

However I get this error:

/var/folders/yo/yoISLF-4EYqDjeiZTSIpOU+++TI/-Tmp-/B047C058-C538-463A-848C-158EB82DAAFE-3501-000033543EE408FE: 
line 14: /Users/derek/projects/Crema/Classes/CoffeeFormController.m.uncrustify: 
No such file or directory

Which makes sense because the file does not yet exist. The command should create it. I also tried using touch to first create the file, but then it tells me it doesn't have permission to write the file ?????

Does anyone know who to store the current contents of the piped in file in xcode user scripts?


cat reads from stdin by default:

cat > /Users/derek/projects/Crema/Classes/CoffeeFormController.m.uncrustify
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜