Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
added 8 characters in body
Source Link
Charles Duffy
  • 299.4k
  • 43
  • 441
  • 497

If you're going to use bash-only syntax like $(<...), your script must be run with bash, not sh.

Thus, either run bash yourscript or add a #!/bin/bash (or similar) shebang, flag the file executable, and invoke it as a command, for example ./yourscript


As an alternative that's both efficient and compatible with POSIX sh:

IFS= read -r SERVER_IP_PORT <"$IPAddressFile" 

If you're going to use bash-only syntax like $(<...), your script must be run with bash, not sh.

Thus, either run bash yourscript or add a #!/bin/bash (or similar) shebang, flag the file executable, and invoke it as a command, for example ./yourscript


As an alternative that's both efficient and compatible with POSIX sh:

read SERVER_IP_PORT <"$IPAddressFile" 

If you're going to use bash-only syntax like $(<...), your script must be run with bash, not sh.

Thus, either run bash yourscript or add a #!/bin/bash (or similar) shebang, flag the file executable, and invoke it as a command, for example ./yourscript


As an alternative that's both efficient and compatible with POSIX sh:

IFS= read -r SERVER_IP_PORT <"$IPAddressFile" 
Source Link
Charles Duffy
  • 299.4k
  • 43
  • 441
  • 497

If you're going to use bash-only syntax like $(<...), your script must be run with bash, not sh.

Thus, either run bash yourscript or add a #!/bin/bash (or similar) shebang, flag the file executable, and invoke it as a command, for example ./yourscript


As an alternative that's both efficient and compatible with POSIX sh:

read SERVER_IP_PORT <"$IPAddressFile" 
Post Made Community Wiki by Charles Duffy