I run a unixODBC installation script in a maven pom.xml file and it has the following output.
Run the command 'cd /tmp/unixODBC.30048.28312.21379/unixODBC-2.3.0; make install' to install the driver manager.
How do I capture the text inside the '' above, e.g., cd /tmp/unixODBC.30048.28312.21379/unixODBC-2.3.0; make install, and then execute it? The /tmp/unixODBC* directory name changes everytime.
you could pipe your maven output to
mvn ...|grep -oP "(?<=')[^']*(?=')"|sh
without the ending |sh you could check if the captured the commands chain correct.
Related
I have a very simple shell script build-dev.sh. This is how it looks like:
#artifact build script
echo "Running application build for DEV environment"
ng build --deploy-url "js/" --base-href "/my-app-ui/" --configuration=dev
mkdir dist/my-app-ui/js
mv ./dist/my-app-ui/*.{js,svg,css} ./dist/my-app-ui/js
It builds the Angular application, then creates a folder js and then it moves files with the extensions js, svg and css to this folder.
When I execute this script directly by myself it works perfectly.
The issue is that I want the script to be executed by Jenkins. So I have configured "Execute shell" step in my build. Once the Jenkins job is executed, it fails on the execution of the third line of the script (mv command).
mv: cannot stat './dist/my-app-ui/*.{js,svg,css}': No such file or directory
Build step 'Execute shell' marked build as failure
I think it might be related to the fact that I have .*{js,svg,css} in my script.
Can you please tell me what I am doing wrong?
Well, I am still not sure why it does not work, but the problem is in the usage of brackets - {js,svg,css}.
I have replaced the mv command with three lines:
mv ./dist/my-app-ui/*.js ./dist/my-app-ui/js
mv ./dist/my-app-ui/*.svg ./dist/my-app-ui/js
mv ./dist/my-app-ui/*.css ./dist/my-app-ui/js
This works perfectly. It is still some kind of workaround, but it's doing the exactly same, so it works fine for me.
I'm hosting my Bamboo on a Windows server and would like to run a script in Bash shell. I have learned that I could do that with in-line shebang. So I selected "Shell" as my interpreter and wrote the script:
#!/bin/bash
perl -pa ebin -s myapp start -detached
The failure report was as below:
'#!' is not recognized as an internal or external command, operable program or batch file.
What was missing here?
Also, I tried to put the above script content in a batch file (.sh) to execute it with Bamboo Command. I put the file in the root directory and set the path of it on Bamboo as just the file name. Then the build just got broken there and there was no log displaying about it.
Any solution that would solve my problem is much appreciated!
(Bamboo version 6.1)
I need to Extract the contents of the Jar in to a specific location. When I run the below command to extract jar,it works correctly.
jar -xf location/ex.jar
The same command I placed inside a script(.sh/.ksh).When I run the script, I get the below error :
jar: not found.
Both the user are same from which I run the script/command. I am using AIX server.
Thanks for Your help.
Your PATH variable isn't set correctly.
Find your java installation : find / -name "java"
Add the correct path to your PATH variable : export PATH="$PATH:/location/to/java/jre/bin"
Or, just use unzip /location/ex.jar
Here's what I am trying to do with my windows batch file script
cd C:\git\foo
call mvn clean install
cp target\foo-bar.war C:\jboss\standalone\deployments\foo-bar.war
call C:\jboss\bin\standalone.bat
After the call to mvn, the execution stops. How do I make the other two lines execute as well?
Note: I have gow installed and I use bash commands such as cp, rm, cd etc...
It works when I uninstall gow. But then I have to change all my commands to windows shell commands. Is there any chance to make it work with gow installed?
How does Python (or MonkeyRunner) locate imported modules?
I previously asked about an error I get when running a monkeyrunner script from Git Bash. I still haven't resolved the issue and decided to try running it from the Windows 7 command line. I cd to the directory containing my .py files and run
> monkeyrunner screenshots.py
Can't open specified script file
Usage: monkeyrunner [options] SCRIPT_FILE
-s MonkeyServer IP Address.
-p MonkeyServer TCP Port.
-v MonkeyServer Logging level (ALL, FINEST, FINER, FINE, CONFIG, INFO, WARNING, SEVERE, OFF)
screenshots.py is indeed in the current directory. Why can't monkeyrunner find it? What do I need to do to fix this to run on Windows 7?
did you try giving full path to your screenshots.py.
monkeyrunner C:\folder_location_to_your_file\scrrenshots.py
There is an easier way to call monkeyrunner script if the cmd is in the directory that contains your script:
monkeyrunner "%cd%\your_script.py"
Make sure you put the "" marks.