In PHP, I have a variable that returns a multi-line text, similar to what is displayed below.
*
*clefF4
*k[f#c#g#d#a#]
*d:
*M6/4
I then want to use this variable in PHP as an argument to execute a bash script.
My PHP code for doing so is below (Where $filechosen is the string of text above):
$output = shell_exec("/path/to/bash/script.sh $filechosen");
echo "<pre>$output</pre>";
Below is that extremely simple bash script that uses the variable '$filechosen' as an argument:
#!/bin/bash
returnExpression=$(echo "$1" | grep 'k\[')
echo $returnExpression
However, when I run this, I get no output. Why is this?