I am developing a script in bash. This script receives a parameter by pipe and passes it to the script.
The problem is that the script is receiving null values.
# curl -s -d 'PATH_ROOT="/opt"' http://dominio.com/setup_cmi/install_cmi.sh |bash
$PATH_ROOT esta vacia, debe indicar el directorio raiz
#!/bin/bash
#Dependencias
declare -a dependencias=( "unzip" "wget" "curl" "mkdir" "tree" )
#command -V unzip
echo "Content-Type: text/plain"
echo
PATH_ROOT=$1
if [ -z "$PATH_ROOT" ]; then
echo "\$PATH_ROOT esta vacia, debe indicar el directorio raiz"
exit;
else
for i in "${dependencias[@]}"; do
command -V $i
if [ $? = 1 ]; then
exit;
fi
done
fi
Also try making the call in this way, with the same result:
curl -s http://dominio.com/setup_cmi/install_cmi.sh | bash -s -- /opt