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 5 years ago.
Improve this question
I was experimenting with pipelines in Git Bash. I ran "ls || vim", thinking that it would open Vim with the contents of the Directory Listing written into the editor. That is not the case, and rather, it saved the file. I haven't been able to find where, though. Any ideas?
Git Bash starts at /d/Desktop, and Git Bash is located at C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Git. Any locations this file might be would be helpful.
EDIT: Sorry, I ran "ls | vim". Also, output was:
"Warning: Input is not from a terminal
Error reading input, exiting...
Preserving Files...
Finished"
EDIT: Sorry for the off-topic post, and thank you for your answers. I'll check out SuperUser if I ever have any more similar questions.
ls || vim
See || as OR. vim is never executed because ls is not False.
ls | vim
See | as pipe. But it will give:
Vim: Warning: Input is not from a terminal
Vim: Error reading input, exiting...
Vim: preserving files...
Vim: Finished.
So use
ls | vim -
because vim will then read from standard-in.
Related
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")"
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.
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".
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 5 years ago.
Improve this question
Via a bash command, I want open a terminal and, from the new terminal, execute a simple bash command.
I tried:
gnome-terminal -- "/bin/bash -c ls"
But I got this error:
I don't understand the error and I cannot find an example anywhere for help.
The quotes are telling the terminal to run an executable in /bin called bash -c ls (with the spaces as part of its name!). There exists no such executable.
Take them out:
gnome-terminal -- /bin/bash -c ls
...or, to actually make something stay open until the user provides input...
gnome-terminal -- /bin/bash -c 'ls; read'
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
When I was using a Linux laptop as my dev machine, I used to do "gedit xxxx" in a Terminal. Now I just switched to MacBook, I d like to do the same thing.
I know that I can open gedit in a command line like "open gedit", but can I add the file name? Otherwise I have to use vim. I am not a fan of vim.
Add
alias gedit="open -a gedit"
to ~/.bash_profile :
Now you'll be able to gedit directly from the command line.
try:
open -a /path/to/gedit /path/to/file.txt
I added the following to my PATH:
:~/Applications/gedit.app/Contents/MacOS/
and afterwards I was able to access gedit from
the command line. One caveat: if gedit is not already running on the system, then it throws an error if I launch it from the command line. Once gedit is already running though, this works to open files in gedit from the command line.
To edit the path, open ~/.profile in an editor
I use textmate for dev, here is a tutorial how it is done for Textmate
http://manual.macromates.com/en/using_textmate_from_terminal.html
I believe the same would apply to gedit.
Hope it helps