Error passing variable to artillery script - artillery

I am using very simple command to test artillery script and trying to pass variable from the command line.
Command is
artillery run -v '{"var1": "value1", "var2": "value2"}' .\test\performance\applications.yml -e development
It is giving error
Variable definition is not valid JSON. Correct example: -v '{"var1": "value1", "var2": "value2"}'
I cannot see any difference in my command and the fricking error. Any help is appreciated.

Answer is found in one of the artillery forums. Inside quotes needs to be escaped. Their documentation is abysmal.
https://github.com/artilleryio/artillery/issues/984

Related

CMake command query (add_custom_command)

I was using the following command for generating Checksum value, .hex and .bin files.
Unfortunately an error comes in the first.
I'm getting error in generating checksum.
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_OBJCOPY} --fill; 0xFF;0x0-0x3CFFD;--checksum=__checksum:2,crc16,0x0;0x0-0x3CFFD
COMMAND ${CMAKE_OBJCOPY} --ihex ${CMAKE_SOURCE_DIR}/Output/exe/${CMAKE_PROJECT_NAME}.elf ${HEX_FILE}
COMMAND ${CMAKE_OBJCOPY} --bin ${CMAKE_SOURCE_DIR}/Output/exe/${CMAKE_PROJECT_NAME}.elf ${BIN_FILE}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/Output/exe
COMMENT "Building ${HEX_FILE} \nBuilding ${BIN_FILE}")
The error pop up as
ielftool error: Missing separator in command line option (expected ';'): "0xFF"
Can anyone help out here? It will be a great help.
Thanks.
I was stucked on the same problem by using ielftool in postBuild via IAR Linux Compiler. At the end I got it running but there are some rules to be considered:
the ";" separator has to be written in quotation marks "';'" ("slash" works also)
last arguments of out-file must be wrapped by ""
spae characters between arguments cause some errors
Example:
/opt/iarsystems/bxarm/arm/bin/ielftool --fill 0xFF';'$FLASH_START-$FLASH_START_HEADER --fill 0xFF';'$FLASH_PROGRAMMCODE_START-$FLASH_PROGRAMMCODE_END --checksum __checksum:4,crc32,0x0';'$FLASH_START-$FLASH_START_HEADER';'$FLASH_PROGRAMMCODE_START-$FLASH_PROGRAMMCODE_END --verbose "$INPUT_FILE" "$INPUT_FILE"
#/opt/iarsystems/bxarm/arm/bin/ielftool --fill 0xFF\;$FLASH_START-$FLASH_START_HEADER --fill 0xFF\;$FLASH_PROGRAMMCODE_START-$FLASH_PROGRAMMCODE_END --checksum __checksum:4,crc32,0x0\;$FLASH_START-$FLASH_START_HEADER\;$FLASH_PROGRAMMCODE_START-$FLASH_PROGRAMMCODE_END --verbose "$INPUT_FILE" "$INPUT_FILE"

Run C program from shell script [duplicate]

I have a script in unix that looks like this:
#!/bin/bash
gcc -osign sign.c
./sign < /usr/share/dict/words | sort | squash > out
Whenever I try to run this script it gives me an error saying that squash is not a valid command. squash is a shell script stored in the same directory as this script and looks like this:
#!/bin/bash
awk -f squash.awk
I have execute permissions set correctly but for some reason it doesn't run. Is there something else I have to do to make it able to run like shown? I am rather new to scripting so any help would be greatly appreciated!
As mentioned in #Biffen's comment, unless . is in your $PATH variable, you need to specify ./squash for the same reason you need to specify ./sign.
When parsing a bare word on the command line, bash checks all the directories listed in $PATH to see if said word is an executable file living inside any of them. Unless . is in $PATH, bash won't find squash.
To avoid this problem, you can tell bash not to go looking for squash by giving bash the complete path to it, namely ./squash.

I am getting error "array.sh: 3: array.sh: Syntax error: "(" unexpected"

I have written the following code:
#!/bin/bash
#Simple array
array=(1 2 3 4 5)
echo ${array[*]}
And I am getting error:
array.sh: 3: array.sh: Syntax error: "(" unexpected
From what I came to know from Google, that this might be due to the fact that Ubuntu is now not taking "#!/bin/bash" by default... but then again I added the line but the error is still coming.
Also I have tried by executing bash array.sh but no luck! It prints blank.
My Ubuntu version is: Ubuntu 14.04
Given that script:
#!/bin/bash
#Simple array
array=(1 2 3 4 5)
echo ${array[*]}
and assuming:
It's in a file in your current directory named array.sh;
You've done chmod +x array.sh;
You have a sufficiently new version of bash installed in /bin/bash (you report that you have 4.3.8, which is certainly new enough); and
You execute it correctly
then that should work without any problem.
If you execute the script by typing
./array.sh
the system will pay attention to the #!/bin/bash line and execute the script using /bin/bash.
If you execute it by typing something like:
sh ./array.sh
then it will execute it using /bin/sh. On Ubuntu, /bin/sh is typically a symbolic link to /bin/dash, a Bourne-like shell that doesn't support arrays. That will give you exactly the error message that you report.
The shell used to execute a script is not affected by which shell you're currently using or by which shell is configured as your login shell in /etc/passwd or equivalent (unless you use the source or . command).
In your own answer, you say you fixed the problem by using chsh to change your default login shell to /bin/bash. That by itself should not have any effect. (And /bin/bash is the default login shell on Ubuntu anyway; had you changed it to something else previously?)
What must have happened is that you changed the command you use from sh ./array.sh to ./array.sh without realizing it.
Try running sh ./array.sh and see if you get the same error.
Instead of using sh to run the script,
try the following command:
bash ./array.sh
I solved the problem miraculously. In order to solve the issue, I found a link where it was described to be gone by using the following code. After executing them, the issue got resolved.
chsh -s /bin/bash adhikarisubir
grep ^adhikarisubir /etc/passwd
FYI, "adhikarisubir" is my username.
After executing these commands, bash array.sh produced the desired result.

Bash Loop 2 Arrays

I'm trying to create a loop for a couple of arrays but I get this error:
./bash.sh: 3: ./bash.sh: source[0]=/media/jon/my\ directory/: not found
This is what my code looks like:
sourceFiles[1]=/media/jon/ACER/Documents\ and\ Settings/Laura/Documents/Shared
destinationFiles[1]=/media/jon/My\ Book/Shared
for index in ${!sourceFiles[#]}
do
sudo rsync -a --delete ${sourceFiles[$index]} ${destinationFiles[$index]}
done
I'm some what green to bash files and this is terribly frustrating that doing a simple loop is so difficult.
Update
I needed a #!/bin/bash at the top per the correct answer.
Your code looks ok. I think you're not using bash though ("not found" is not a bash error message). Are you perhaps using /bin/sh? On many systems that's a minimal POSIX shell, not bash.
A POSIX shell would not recognize sourceFiles[1]=... as an assignment and would consequently run it as a command. Hence the "not found" error.
Try enclosing in double quote your variables in your sudo line:
sudo rsync -a --delete "${sourceFiles[$index]}" "${destinationFiles[$index]}"

Exact command for starting a batch file by using powershell

I know this question has been asked before and I found a thread on here which almost gives me the solution I need.
Here is the link: How to run batch file using powershell
But this only works when I write out the full path. For example:
c:\Users\Administrator\Desktop\dcp_bearbeitet\start.bat -p c:\Users\Administrator\Desktop\dcp_bearbeitet\start.prop
What I want to reach is a solution which accepts a path with parameters, like this one here:
c:\Users\Administrator\Desktop\dcp_bearbeitet\$title\start.bat -p c:\Users\Administrator\Desktop\dcp_bearbeitet\$title\start.prop
Whereas $title contains the name of my file which I am using in this case. I know that I can create another parameter for the -p command and I know that this works, but unfortunately when I try the same method for the first command I always get an error message.
I hope you guys know a way to solve this problem.
I think Invoke-Expression could help here.
Just construct your path like you want it to be, for example:
$title = "file"
$path = "C:\Users\Administrator\Desktop\dcp_bearbeitet\$title\start.bat -p c:\Users\Administrator\Desktop\dcp_bearbeitet\$title\start.prop"
and then invoke it:
Invoke-Expression $path
Regards Paul

Resources