I am trying to dynamically create and write to a file a bash script from from a current bash script.
echo "## Get the IP of the system that was assigned
#!/bin/bash
ip=$( hostname -i | xargs )
echo $ip " > second_script.sh
rather echo out the lines it is executing them, so that I end up with expanded/evaluated variables in second_script.sh.
## Get the IP of the system that was assigned
#!/bin/bash
ip=10.0.2.15
...
How can I write out bash shell script commands and suppress evaluation, and be able to execute the script later on?