How can I run msys2 console on cmd current directory? - msys2

I installed msys2 but I can't run msys2 console on cmd current directory.
example
cmd console
cd path/to/mypath
msys2 -mingw64 # not run on path/to/mypath dir runs only its own default path
SORRY. I don't know how to write comment code in cmd konsole.
Thanks.

You can edit msys2.ini, mingw32.ini, or mingw64.ini and add this line to it:
CHERE_INVOKING=1
More information is in the README of msys2-launcher.

Related

Newman command not found

I am trying to run m collection through jenkins but it shows below error:
** Started by user trideep mukherjee Running as SYSTEM Building in workspace
C:\Program Files (x86)\Jenkins\workspace\Newman [Newman] $
cmd /c call C:\WINDOWS\TEMP\jenkins8980552465408575800.bat C:\Program
Files (x86)\Jenkins\workspace\Newman>cd
C:\Users\tride\AppData\Roaming\npm\node_modules\newman
C:\Users\tride\AppData\Roaming\npm\node_modules\newman>newman
--version ‘newman’ is not recognized as an internal or external command, operable program or batch file.
C:\Users\tride\AppData\Roaming\npm\node_modules\newman>exit 9009 Build
step 'Ex**
I have tried the all possible ways mention in the blog to add the local path of the newman but didn’t worked.
Please see the environment variable I have added
Set newman installation path to path in windows or in linux as environment variable.
Then it will work

Flatpak Intellij Idea - problem with subversion executable

After installing Intellij Idea using flatpak on Clear Linux I'm not able to make it run svn executable.
I added ---filesystem=host to flatpak permissions and tried to set executable path to /run/host/usr/bin/svn but with no luck (path is available/exists, though Intellij keeps complain)
svn command is normally available from system terminal.
When I try to run /run/host/usr/bin/svn command via Intellij Idea built-in terminal, I've got error that library is not available:
sh-5.0$ /run/host/usr/bin/svn
/run/host/usr/bin/svn: error while loading shared libraries: libsvn_client-1.so.0: cannot open shared object file: No such file or directory
I also tried set flatpak-spawn. Following command works perfectly fine in Intellij Idea built-in terminal:
/usr/bin/flatpak-spawn --host /usr/bin/svn, though when set as path to svn executable still gives me Intellij Idea error:
"The path to Subversion executable is probably wrong"
Could anybody please help with making it work?
TLDR: You probably need to add the path to svn into your IntelliJ terminal Path.
Details:
It looks like you are having a path issue. I had a similar problem running kubectl running PyCharm installed from a flatpak on Pop_Os.
If I try to run kubectl I see the following:
I have kubectl installed in /usr/local/bin. This is a screenshot from my 'normal' terminal.
In the PyCharm terminal this location is mounting under /run/host/usr/local/bin/.
If I look at my path in the PyCharm terminal, it is not there.
So I'll add the /run/host/usr/local/bin/ to my path and I can then run kubectl:
To make sure this comes up all the time, I need to add the PATH to the Terminal settings:
I can now execute any of the commands in my /usr/local/bin dir.
I found a really ugly solution for dealing with SVN with the JetBrains family, which does actually answer the question. But in a very roundabout way. Unfortunately Alex Nelson's solution didn't work for me.
You would think the Flatpak would come with a valid SVN, since it's actually part of the expected requirements for the program...
When in the terminal, you can run
cd ..
/usr/bin/flatpak-spawn --host vim ./svn
Then press i to go into input mode, then paste the following in the opened text file (Basically what it does is create an executable which passes it to the flatpak-spawn invocation):
#!/bin/bash
/usr/bin/flatpak-spawn --host /usr/bin/svn $#
Save and quit from vim (ESC, then :wq!). Make it executable:
chmod +x svn
Then in IntelliJ's menu, set the "path to svn" to
/home/<yourusername>/IdeaProjects/svn
It's worked for everything I've tried... Hope this helps out anyone else who was struggling with this.
I am using a similar solution to caluga.
#!/bin/sh
cd
exec /usr/bin/env -- flatpak-spawn --host /usr/bin/env -- svn "$#"
exec makes it replace the wrapper script process so the wrapper script process can end.
I'm using /bin/sh instead of /bin/bash as bash features are not needed.
using /usr/bin/env, but maybe not necessary if PATH is set up right.
remember to quote "$#" in case there are spaces in arguments.
I am putting it in ~/.local/bin and referencing it with its absolute path in the IntelliJ settings (Settings -> Version Control -> Subversion -> Path to Subversion executable).
I also was running into problems with IntelliJ saying that /app/idea-IC path does not exist. Figured that something outside the flatpak (i.e. svn or env) was trying to change directory to the working directory from where the wrapper script was invoked (inside the flatpak). Using cd allows the wrapper script to change to a directory that exists both inside the flatpak and on the host.
Fedora Silverblue or toolbox users might want to use dev tools inside their toolbox, in which case you can do:
#!/bin/sh
cd
exec /usr/bin/env -- flatpak-spawn --host toolbox run svn "$#"

Creating pg_dump file in OS terminal

I tried to find it out on google, but didn't worked well so I hope to find help here! :)
I am trying to create a pg_dump file on mac osx but there is no \bin folder as needed in cmd on windows.
My question is how to create the pg_dump file on mac osx?
Best regards!
Depends on where you installed PostgreSQL from. If its the .dmg from postgresql.org then the command will be in:
/Library/PostgreSQL/<version eg. 9.6>/bin
This is not in the PATH so you will have to either cd to the directory and run the command or add the directory to the PATH.
Another option is to search for the command with:
cd /
find ./ -name pg_dump

Running .sh scripts in Git Bash

I'm on a Windows machine using Git 2.7.2.windows.1 with MinGW 64.
I have a script in C:/path/to/scripts/myScript.sh.
How do I execute this script from my Git Bash instance?
It was possible to add it to the .bashrc file and then just execute the entire bashrc file.
But I want to add the script to a separate file and execute it from there.
Let's say you have a script script.sh. To run it (using Git Bash), you do the following: [a] Add a "sh-bang" line on the first line (e.g. #!/bin/bash) and then [b]:
# Use ./ (or any valid dir spec):
./script.sh
Note: chmod +x does nothing to a script's executability on Git Bash. It won't hurt to run it, but it won't accomplish anything either.
#!/usr/bin/env sh
this is how git bash knows a file is executable. chmod a+x does nothing in gitbash. (Note: any "she-bang" will work, e.g. #!/bin/bash, etc.)
If you wish to execute a script file from the git bash prompt on Windows, just precede the script file with sh
sh my_awesome_script.sh
if you are on Linux or ubuntu write ./file_name.sh
and you are on windows just write sh before file name like that sh file_name.sh
For Linux -> ./filename.sh
For Windows -> sh file_name.sh
If your running export command in your bash script the above-given solution may not export anything even if it will run the script. As an alternative for that, you can run your script using
. script.sh
Now if you try to echo your var it will be shown. Check my the result on my git bash
(coffeeapp) user (master *) capstone
$ . setup.sh
done
(coffeeapp) user (master *) capstone
$ echo $ALGORITHMS
[RS256]
(coffeeapp) user (master *) capstone
$
Check more detail in this question
I had a similar problem, but I was getting an error message
cannot execute binary file
I discovered that the filename contained non-ASCII characters. When those were fixed, the script ran fine with ./script.sh.
Once you're in the directory, just run it as ./myScript.sh
If by any chance you've changed the default open for .sh files to a text editor like I had, you can just "bash .\yourscript.sh", provided you have git bash installed and in path.
I was having two .sh scripts to start and stop the digital ocean servers that I wanted to run from the Windows 10. What I did is:
downloaded "Git for Windows" (from https://git-scm.com/download/win).
installed Git
to execute the .sh script just double-clicked the script file it started the execution of the script.
Now to run the script each time I just double-click the script
#!/bin/bash at the top of the file automatically makes the .sh file executable.
I agree the chmod does not do anything but the above line solves the problem.
you can either give the entire path in gitbash to execute it or add it in the PATH variable
export PATH=$PATH:/path/to/the/script
then you an run it from anywhere

Git Bash prompt does not open - GIt bash installation

I have installed several times the package GI-1.9.4-preview20140611.exe on my Windows 8. When I try to open the git bash command window, the window opens, but it is empty, no showing the usual welcome message and the git prompt.
I have tried changing the command for the sh.exe file, which usually has the format
"sh.exe --login -i" into just "sh.exe". The shell opens then, the PS1 variable shows only the sh.exe file name and version, nothing more. Is there something wrong with my installation?
Thanks!
Your installation is fine.
The git executable(sh.exe) for Command Line Tool is a script that in order to work will be based on the your windows Command Prompt (cmd.exe)
You will need the following string to refer to Git correctly as an executable:
C:\Windows\SysWOW64\cmd.exe /c ""C:\Program Files (x86)\Git\bin\sh.exe" --login -i"
Or you can always 'right-click' and SELECT 'Git Bash Here' or 'Git GUI Here'