I have store ip address with port in a file and I want to read it using shell script. Thus file serverIP has data 192.168.1.17:3000. I am using following bash script to read it
IPAddressFile=/home/geo/serverIP SERVER_IP_PORT=$(<$IPAddressFile) echo $SERVER_IP_PORT But this script echo empty string. Where I am making mistake?
sh yourscriptit won't have bash-only extensions such as$(<...); it must be invoked with bash as the shell.bash scriptfile, or set it executable with a#!/bin/bashshebang and run./scriptfile.