Scheme and Build Pre-Action Script Output? [duplicate] - xcode

This question already has answers here:
How to display compiler output or custom build steps output when building with xcode?
(7 answers)
Closed 5 years ago.
I have a scheme in Xcode 4. I edited the scheme so that Build has a Pre-Action, and that action is a script.
The script is simple - it dumps pre-processor defines: cpp -dM < /dev/null.
Where do I find the output of the script?

add this line to pre-action script
pwd > ~/current_directory.txt
then check file current_directory.txt in your home directory

Related

How to run a program with one command? [duplicate]

This question already has answers here:
How to compile Go program consisting of multiple files?
(7 answers)
How to compile a program in Go
(1 answer)
Go: How does go run file.go work
(4 answers)
Closed 9 months ago.
I have an app. There are many .go files, but also there are files with tests.
Of course, the command go run *.go don't work correct.
And now I should write every time something like that: go run fileName.go fileName.go fileName.go and so forth.
Is it possible to run programs with a shorter command ?
Thank You

Programmatically add functions to a user's bash profile [duplicate]

This question already has answers here:
How to install a bash function containing variables using a bash script? [duplicate]
(2 answers)
Create a script that adds lines of code to .bashrc then reloads the terminal
(2 answers)
Closed 4 years ago.
I've written a very simple utility to allow a couple of colleagues to easily access some system logs.
The dependencies for this are installed by running a curl to an install.sh file on GitHub.
There are a couple of functions and aliases that are handy to have in your bash profile. Out of interest how would I programmatically add items to a user's bash profile in a shell script.

Is there a way to step through Bash Scripts [duplicate]

This question already has answers here:
How execute bash script line by line?
(5 answers)
Closed 4 years ago.
I work with git-bash in windows. I have found a bash script that I would like to modify on GitHub. I cloned it and opened it in my pycharm editor. There is a plugin https://www.plugin-dev.com/project/bashsupport/#installation which I've added, but from the documentation this does things like syntax highlighting. Is there a way to step through the code line by line, set breakpoints etc. I don't have much shell scripting experience and stepping through the code might speed up my learning .
I usually debug using -x flag (short for xtrace or execution trace) is useful to add execution information Debugging Bash scripts).
You can use it by executing:
bash -x your-script.sh
or adding adding into your script:
set -x

why bash shell does not make any difference after executed? [duplicate]

This question already has answers here:
Global environment variables in a shell script
(7 answers)
Closed 5 years ago.
I'm working a small project which needs using OpenMPI to make "mpicc" work.
I made a file make_cmd:
#!/bin/bash
module load OpenMPI
However, after executing ./make_cmd, I was told:
mpicc: command not found
But if I just type on the command line: module load OpenMPI, then mpicc is working.
Why is that? Thanks!
See this answer on neighbouring site.
Because module is an alias/shell function and not a binary program, it's not necessarily available in the non-interactive sub-shell that is created when you run your script. You could probably run source make_cmd though, as that will just run the commands in your current interactive shell. You could ditch the #!/bin/bash line in that case.

How to trim off the ".java" from a Java file when running in Bash script? [duplicate]

This question already has answers here:
How do I remove the file suffix and path portion from a path string in Bash?
(15 answers)
Closed 7 years ago.
I have a few Java tests that I'd like to run by doing java <test-name>. But, all of the files are either .class or .java.
How do I trim off the end in a Bash script or in the terminal so that the command reads java <test-name>?
If you're using bash you can do the following
$ file="path/Foo.class"
$ echo "${file%.class}"
path/Foo

Resources