Author Topic: How to run bash script, in Linux?  (Read 7677 times)

Offline PaulPaul

  • Single posting newcomer
  • *
  • Posts: 7
How to run bash script, in Linux?
« on: April 02, 2009, 07:29:53 pm »
I've just switched from Eclipse to C::B. In Eclipse I setup a toolbar button that would run a bash script that would shutdown a Linux service, compile the application (manual make) and then restart the service. Eclipse would also save all pending files which was nice so I could be certain that the compile incorporated all the changes.

How can I do the same in C::B?

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: How to run bash script, in Linux?
« Reply #1 on: April 02, 2009, 08:05:04 pm »
To manually start any tools you want you can add them to the "Tools"-menu, but that will not save any open files.

The easiest way to do this would be to use a custm-makefile project (in your case) and pre- and/or post-build steps.

Just create an empty project, add all the files that belong to it via the context-menu in the management pane, open the projects properties via the context-menu, and chose this is a custom makefile (and the makefile name) at the first tab.

You most likely have to fix the make commands in the "Make commands" tab of the projects build options.

In the build options you can also add post and pre-build steps.

If you click the build, or rebuild-button the project-manager will save all files automatically.

At the moment, the makefile has to be in the projects base-directory, but I have a patch on my computer, that will make it possible to change the makefiles execution directory.

The patch is not (yet) tested on windows, but this might happen this evening and so I might be able to commit it today.

Offline PaulPaul

  • Single posting newcomer
  • *
  • Posts: 7
Re: How to run bash script, in Linux?
« Reply #2 on: April 07, 2009, 11:53:30 pm »
I find it odd that there isn't a Save-All-and-Build, all-in-one button feature.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: How to run bash script, in Linux?
« Reply #3 on: April 08, 2009, 07:01:32 am »
I find it odd that there isn't a Save-All-and-Build, all-in-one button feature.

If you click the build, or rebuild-button the project-manager will save all files automatically.

What's wrong with this ?

Offline PaulPaul

  • Single posting newcomer
  • *
  • Posts: 7
Re: How to run bash script, in Linux?
« Reply #4 on: April 08, 2009, 07:24:51 am »
Oh, it's just because of the way I'm doing things. I have multiple projects that are all a part of my workspace, which are all part of one large application. Build will save the files for the selected project but not in any projects. I have one manual make file in a 'fake' project that I use to compile every individual project but again, I have to remember to save all my files first. Not a big deal unless you forget. I'm trying to figure out how to make a script to do the SaveAll (I have that much working) but I can't figure out how to execute the build.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: How to run bash script, in Linux?
« Reply #5 on: April 08, 2009, 07:41:27 am »
You can also use build workspace from the build menu and if needed create a keyboard-shortcut for it with the keybinder-plugin.

If you set up dependencies between the projects correctly, you do not need any fake makefiles and all project files will be saved before the build.

Offline PaulPaul

  • Single posting newcomer
  • *
  • Posts: 7
Re: How to run bash script, in Linux?
« Reply #6 on: April 08, 2009, 06:16:35 pm »
I'm having a bit of a 'duh' moment :? Of course I tried the Build Workspace before but I must have had a problem with my makefile and this confused me into thinking the Build Workspace wasn't what I needed. It appears to work fine now. I would still like to know the script command to build a workspace or project. Is there one? I looked for hours...