I really need your help with this: The thing is: I am trying to build my app into .pkg file, at the same time I want to integrate node.js into my .pkg installation file and it will be installed if the OS doesn't have nodejs. When I try to write a script to judge whether the user has already installed the node, I was stuck by "return value of the external script". I try my script at the end with 'echo' 'return' 'exit' but still not work.enter image description here
Here is the screenshot of "Packages" when I try to insert the script..
And this is the script I wrote.`#!/bin/bash
OUTPUT="$(node -v)"
echo ${OUTPUT}
if [[ $OUTPUT = "" ]];
then
echo "1"
return 1
#no node
else
echo "0"
return 0
#node found
fi
` Pls help me
This script will run the "node -v" command and send output (stderr and stdout) to /dev/null; nothing is displayed to user. The if condition checks if the command ran successfully and sets the exit status to 0 or 1 depending on the outcome.