Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

BerGaur

macrumors regular
Original poster
Dec 12, 2011
108
0
Inside my head
I am using version 4.5.2, and when I use it to write a script it automatically has some notes and one line of code written, which isn't really a big problem, but the line of code sets the sh shell: #!/bin/sh And I prefer bash. Now, I just replace sh with bash, but I would like to set this so it will pop up with #!/bin/bash by default.

Is there a way to do this? If so, how?
 

BerGaur

macrumors regular
Original poster
Dec 12, 2011
108
0
Inside my head
As I tried to find a way to do this myself, I ran into a bigger problem. It seems that if I make a script with the .tool extension, xcode doesn't show the proper text color scheme.

So, I found a way to fix both these problems. I found a way to make my own custom templates. This will usually allow it to load with borne shell as the text color, but not every time. So I then simply made a key stroke for xcode (command+B) to set the borne shell text colors.

I will make a video and put it on youtube to show how I made the template as soon as I can. I will update this thread as soon as the youtube video is up.
 

ElectricSheep

macrumors 6502
Feb 18, 2004
498
4
Wilmington, DE
XCode templates are located within the XCode Application Bundle itself:

Code:
/Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File Templates/

The shell script template is under "Other". Simply change it to use the shell of your choice, and any new shell script files you create inside of XCode will use the template.
 

benwiggy

macrumors 68020
Jun 15, 2012
2,473
289
Altering the contents of application packages, particularly Apple ones, is rarely a good idea; I wouldn't be surprised if you couldn't create the same sub-folders (from Xcode/Templates downwards) in your user Library or /Library, and Xcode might still use them.
 

BerGaur

macrumors regular
Original poster
Dec 12, 2011
108
0
Inside my head
Video now on YouTube

Sorry, I forgot to mention on here like I said I would. The link to my YouTube video on how I managed this is below. The video shows me making a template for python. But the same can be done for bash as well.

I also made a custom keystroke through System Preferences > Keyboard > Applications specifically for Xcode that, with Command+B, it will set the Syntax coloring to Bourne. Just incase it glitches like it sometimes does and shows my bash script, .tool, with no syntax coloring.

http://youtu.be/GNBjvkIOK98
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.