Finding the PATH which my Git Bash executes [closed] - bash

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 4 years ago.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Improve this question
I'm trying to install a GDB debugger onto my Git Bash for Windows 10, but after downloading the gdb-8.2.tar.gz file and extracting it into a folder gdb-8.2, I've been unable to locate the path for which git bash could locate this program, thus it reports "bash: cdgb command not found".
I assume I'm putting the folder in the wrong directory. Question: What command can I use to find out what path git bash is currently using to execute so that I can place my folder gdb-8.2 there?
I'm well aware of what directory my git is located in. I'm asking where can I place this and future files for git bash to locate and execute.

bash: cdgb command not found
This should be a $PATH issue: check the output of echo $PATH (from your git bash session), and make sure it references a folder which includes the executable cdgb.
If not, type (still in that same git bash session, for testing)
export PATH=$PATH:/path/to/folder/including/cdgb
That would be:
export PATH=/c/path/to/folder
If you have spaces in that path, see "git-bash $PATH cannot parse windows directory with space".

Related

How to open Windows file editing app from WSL [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 months ago.
Improve this question
This answer states that the following will be possible:
For example, from the WSL command line you'll be able to type code /mnt/c/Users/username/src/windows-file.txt to open a Windows file in
VS Code, or type code /home/username/src/linux-file.txt to open a
Linux file in VS Code.
is it already possible with the newest WSL 2 and Windows 11 21H2?
At this point what I can do from inside WSL is to open the folder like this:
explorer.exe .
Which is already pretty awesome. But it would be even better to instead of running:
nano myfile.txt
open the file in Notepad++:
notepadpp myfile.txt
Sure, you can run any Windows executable this way.
notepad.exe myfile.txt will work, for example.
If your Notepad++ is in your PATH, then notepad++.exe would work too - mine isn't, though, so I have to use the full path:
/mnt/c/Program\ Files/Notepad++/notepad++.exe myfile.txt
You can of course create a shell script or an alias to shorten this command.
Just note that if you specify a file with a path then you will have an issue because the Linux path is passed verbatim to the Windows executable, but that can be fixed with wslpath.
Here is an example shell script that you could put into ~/bin/notepadpp for example:
#!/bin/bash
/mnt/c/Program\ Files/Notepad++/notepad++.exe "$(wslpath -w "$1")"

zsh: command not found: build.sh [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
When I try to build my project on the Mac I get the error: zsh: code not found: build.sh
I use IntelliJ and Docker.
Anyone have any idea how to fix this?
Tried some different things already:
Add permission to execute which you did already with chmod +x *.sh (try to avoid that since it gives permission to execute to all scripts, including ones that you don't want to be executable; Instead write specific file name - in your case chmod +x build.sh)
You can execute scripts with ./scriptname.sh for example ./build.sh - you did it before but without execute rights which now your script has.
Your shell doesn't know what is build.sh.
Execute this ./build.sh
If a file is not executable, you need to make it with this command sudo chmod +x build.sh

Bash: mate : command not found [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 years ago.
Improve this question
Hi I am learning how to use Github online via Udemy course. The instructor is accessing textmate editor using MAC OS. However I am trying to access textmate editor in Windows 10. When in Git bash I type
mate file_name.txt
It throws an error
bash: mate: command not found.
How can this be resolved. Any help will be appreciated.
Text Mate works only in MAC OS and not in Windows. Sublime Text is a good editor to work with in Windows:
Steps to open Sublime Text from Git bash (after installing Sublime text first in system) are as follows:
In Git bash(you can open from Search) type the below 2 commands:
alias subl="/c/Program\ Files/Sublime\ Text\ 3/sublime_text.exe"
subl .
Instead of subl . you can also open a specific file or create a new file using below:
subl Filename.txt
This command subl Filename.txt will create a new file with name as Filename.txt otherwise will open an existing file with the same name if the file already exists.

What is difference .sh file to change executable (chmod +x) and not? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I notice when make a .sh file, usually, then we edit file's executable flag
$ chmod +x <sth>.sh
But without that executable flag, the .sh file can be executable.
$ sh ./<sth>.sh
why we need chmod?
Have a nice day!
By using chmod and turning on execute permissions, you can just run the file using
<sth>.sh
Without executable permissions, if you have read permissions you can still run scripts but you must use an interpreter, such as sh or bash
When you do
sh <sth>.sh
What this means is run the sh command, which reads the .sh file, and then interprets it, therefore you don't need execute permissions.
when you don't give the executable permission to the file , you have to mention with which binary you want to run your file .
for example you have to run file like
sh example.sh
but when you give the file executable permission you are allowed to run the file as ./example.sh

How to change the terminal prompt to just current directory? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I am using a Macbook Pro, and I wanted to change it to the current directory and a dollar sign prompt in Terminal. I've already looked at these resources to try and solve this issue.
I tried modifying the ~/.bashrc file and saving it but it did not seem to work.
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"
export PS1="\W$ ”
The last line is what I added to change the prompt.
This should be done in .bash_profile, not .bashrc.
nano ~/.bash_profile
Add a line containing this:
export PS1="\W\$ "
.bashrc is ONLY excuted when starting a sub-shell. bash login shell uses the following initialization scripts:
.bash_profile
.bash_login
.profile
You need to escape the dollar sign. Like this:
$ PS1="\W\$ "
~$ cd tmp
/Users/philip/tmp
tmp$
And once you change your .bashrc you either need to logout/back-in or . ~/.bashrc to re source it.
I would humbly recommend not doing this. Having a full path is very useful as 'tmp' directories could be anywhere. Consider using "\w" which does relative path (ie. uses ~ to represent HOME)

Resources